From 5a28a93ab6eca5606661bf6b67f5d9d82167fb8c Mon Sep 17 00:00:00 2001 From: Carl Schwan Date: Fri, 28 May 2021 14:56:36 +0200 Subject: [PATCH] Fix reverse tabbing not working in autocompletion Now call autocomplete() also for shift+tab Fix #377 (cherry picked from commit 3329739d556180b711ca78c628b21dbc9261b0bc) --- imports/NeoChat/Component/ChatBox/ChatBar.qml | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/imports/NeoChat/Component/ChatBox/ChatBar.qml b/imports/NeoChat/Component/ChatBox/ChatBar.qml index 05a9f2d22..0ddf577fb 100644 --- a/imports/NeoChat/Component/ChatBox/ChatBar.qml +++ b/imports/NeoChat/Component/ChatBox/ChatBar.qml @@ -165,12 +165,18 @@ ToolBar { nextItemInFocusChain(false).forceActiveFocus(Qt.TabFocusReason) return } - let decrementedIndex = completionMenu.currentIndex - 1 - // Wrap around to the last item - if (decrementedIndex < 0) { - decrementedIndex = Math.max(completionMenu.count - 1, 0) // 0 if count == 0 + if (!autoAppeared) { + let decrementedIndex = completionMenu.currentIndex - 1 + // Wrap around to the last item + 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: { @@ -187,7 +193,7 @@ ToolBar { // ignore first time tab was clicked so that user can select // first emoji/user - if (autoAppeared === false) { + if (!autoAppeared) { let incrementedIndex = completionMenu.currentIndex + 1; // Wrap around to the first item if (incrementedIndex > completionMenu.count - 1) {