mirror of
https://github.com/zoriya/noctalia-shell.git
synced 2026-06-05 11:40:00 +00:00
Launcher: replace select next/previous usage with wrapping version
This commit is contained in:
@@ -207,20 +207,6 @@ NPanel {
|
||||
|
||||
// ---------------------
|
||||
// Navigation
|
||||
function selectNext() {
|
||||
if (results.length > 0) {
|
||||
// Clamp the index to not exceed the last item
|
||||
selectedIndex = Math.min(selectedIndex + 1, results.length - 1)
|
||||
}
|
||||
}
|
||||
|
||||
function selectPrevious() {
|
||||
if (results.length > 0) {
|
||||
// Clamp the index to not go below the first item (0)
|
||||
selectedIndex = Math.max(selectedIndex - 1, 0)
|
||||
}
|
||||
}
|
||||
|
||||
function selectNextWrapped() {
|
||||
if (results.length > 0) {
|
||||
selectedIndex = (selectedIndex + 1) % results.length
|
||||
@@ -269,13 +255,13 @@ NPanel {
|
||||
|
||||
Shortcut {
|
||||
sequence: "Ctrl+K"
|
||||
onActivated: ui.selectPrevious()
|
||||
onActivated: ui.selectPreviousWrapped()
|
||||
enabled: root.opened && searchInput.inputItem && searchInput.inputItem.activeFocus
|
||||
}
|
||||
|
||||
Shortcut {
|
||||
sequence: "Ctrl+J"
|
||||
onActivated: ui.selectNext()
|
||||
onActivated: ui.selectNextWrapped()
|
||||
enabled: root.opened && searchInput.inputItem && searchInput.inputItem.activeFocus
|
||||
}
|
||||
|
||||
@@ -351,10 +337,10 @@ NPanel {
|
||||
}
|
||||
})
|
||||
searchInput.inputItem.Keys.onDownPressed.connect(function (event) {
|
||||
ui.selectNext()
|
||||
ui.selectNextWrapped()
|
||||
})
|
||||
searchInput.inputItem.Keys.onUpPressed.connect(function (event) {
|
||||
ui.selectPrevious()
|
||||
ui.selectPreviousWrapped()
|
||||
})
|
||||
searchInput.inputItem.Keys.onReturnPressed.connect(function (event) {
|
||||
ui.activate()
|
||||
|
||||
Reference in New Issue
Block a user