From bc3d6d902f1932cf2d38196309bf064e07772b63 Mon Sep 17 00:00:00 2001 From: miruka Date: Sat, 22 Aug 2020 01:20:55 -0400 Subject: [PATCH] Fix @autocomplete closing after one character Typing e.g. "@a" would work, but "@ab" would always instantly close the autocompletion UI if the cursor was at the end of the text area. --- src/gui/Pages/Chat/AutoCompletion/UserAutoCompletion.qml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gui/Pages/Chat/AutoCompletion/UserAutoCompletion.qml b/src/gui/Pages/Chat/AutoCompletion/UserAutoCompletion.qml index 469667a3..0a0e2060 100644 --- a/src/gui/Pages/Chat/AutoCompletion/UserAutoCompletion.qml +++ b/src/gui/Pages/Chat/AutoCompletion/UserAutoCompletion.qml @@ -159,12 +159,13 @@ HListView { const start = root.wordToComplete.start let end = root.wordToComplete.end + 1 - if (currentIndex !== -1) { - const member = model.get(currentIndex) + if (root.currentIndex !== -1) { + const member = root.model.get(root.currentIndex) const repl = member.display_name || member.id end = root.wordToComplete.start + repl.length } + if (pos === root.textArea.length) return if (pos < start || pos > end) root.accept() }