Fix reverse tabbing not working in autocompletion

Now call autocomplete() also for shift+tab

Fix #377
This commit is contained in:
Carl Schwan
2021-05-28 14:56:36 +02:00
parent 7bec8c73f8
commit 3329739d55

View File

@@ -165,12 +165,18 @@ ToolBar {
nextItemInFocusChain(false).forceActiveFocus(Qt.TabFocusReason) nextItemInFocusChain(false).forceActiveFocus(Qt.TabFocusReason)
return return
} }
let decrementedIndex = completionMenu.currentIndex - 1 if (!autoAppeared) {
// Wrap around to the last item let decrementedIndex = completionMenu.currentIndex - 1
if (decrementedIndex < 0) { // Wrap around to the last item
decrementedIndex = Math.max(completionMenu.count - 1, 0) // 0 if count == 0 if (decrementedIndex < 0) {
decrementedIndex = Math.max(completionMenu.count - 1, 0) // 0 if count == 0
}
completionMenu.currentIndex = decrementedIndex
} else {
autoAppeared = false;
} }
completionMenu.currentIndex = decrementedIndex
chatBar.complete();
} }
Keys.onTabPressed: { Keys.onTabPressed: {
@@ -187,7 +193,7 @@ ToolBar {
// ignore first time tab was clicked so that user can select // ignore first time tab was clicked so that user can select
// first emoji/user // first emoji/user
if (autoAppeared === false) { if (!autoAppeared) {
let incrementedIndex = completionMenu.currentIndex + 1; let incrementedIndex = completionMenu.currentIndex + 1;
// Wrap around to the first item // Wrap around to the first item
if (incrementedIndex > completionMenu.count - 1) { if (incrementedIndex > completionMenu.count - 1) {