diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2025-08-21 13:38:47 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2025-08-21 13:38:53 +0800 |
| commit | 88eefa927912f426aa6579ee7a261980302ab400 (patch) | |
| tree | 91c0c658bda7be9e605f965f786c505ac5de433d | |
| parent | b9d10b091d92300de26178474a09bfce4bee12e6 (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
| -rw-r--r-- | popups/launcher/components/App.qml | 6 | ||||
| -rw-r--r-- | popups/launcher/components/Clip.qml | 11 |
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) { |
