From 88eefa927912f426aa6579ee7a261980302ab400 Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Thu, 21 Aug 2025 13:38:47 +0800 Subject: 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 --- popups/launcher/components/App.qml | 6 +++--- 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) { -- cgit v1.2.3