summaryrefslogtreecommitdiff
path: root/popups
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2025-08-21 13:38:47 +0800
committerlittleblack111 <littleblack11111@gmail.com>2025-08-21 13:38:53 +0800
commit88eefa927912f426aa6579ee7a261980302ab400 (patch)
tree91c0c658bda7be9e605f965f786c505ac5de433d /popups
parentb9d10b091d92300de26178474a09bfce4bee12e6 (diff)
fix(App): home and end proper return
fix(App): WARN scene: @popups/launcher/components/App.qml[28:-1]: TypeError: Cannot read property 'name' of undefined feat(Clip): support home and end
Diffstat (limited to 'popups')
-rw-r--r--popups/launcher/components/App.qml6
-rw-r--r--popups/launcher/components/Clip.qml11
2 files changed, 14 insertions, 3 deletions
diff --git a/popups/launcher/components/App.qml b/popups/launcher/components/App.qml
index a88c24a..d0bb5a6 100644
--- a/popups/launcher/components/App.qml
+++ b/popups/launcher/components/App.qml
@@ -25,7 +25,7 @@ IComponent {
}
}
- property string predictiveCompletion: valid ? entries[selectedIndex].name.slice(input.length) : ""
+ property string predictiveCompletion: valid ? entries[selectedIndex]?.name.slice(input.length) || "" : ""
process: function () {
const isValid = entries.length > 0;
@@ -53,13 +53,13 @@ IComponent {
}
home: function () {
- if (listView.count === 0)
+ if (selectedIndex <= 0)
return true;
selectedIndex = -1;
selectedIndex = 0;
}
end: function () {
- if (listView.count === 0)
+ if (selectedIndex + 1 > listView.count - 1)
return true;
selectedIndex = listView.count;
selectedIndex = listView.count - 1;
diff --git a/popups/launcher/components/Clip.qml b/popups/launcher/components/Clip.qml
index 138cb10..b4daea9 100644
--- a/popups/launcher/components/Clip.qml
+++ b/popups/launcher/components/Clip.qml
@@ -41,6 +41,17 @@ IComponent {
return true;
selectedIndex++;
}
+ home: function () {
+ if (selectedIndex <= 0)
+ return true;
+ selectedIndex = -1;
+ selectedIndex = 0;
+ }
+ end: function () {
+ if (selectedIndex + 1 > listView.count - 1)
+ return true;
+ selectedIndex = listView.count - 1;
+ }
onClipHistChanged: {
if (selectedIndex !== -1) {