diff --git a/imports/NeoChat/Component/ChatTextInput.qml b/imports/NeoChat/Component/ChatTextInput.qml index 147c30bf2..8c21e07c5 100644 --- a/imports/NeoChat/Component/ChatTextInput.qml +++ b/imports/NeoChat/Component/ChatTextInput.qml @@ -306,6 +306,18 @@ ToolBar { isAutoCompleting = false autoCompleteListView.currentIndex = 0 } + + var autoCompletePrefix = text.substring(0, cursorPosition).split(" ").pop(); + if (!autoCompletePrefix) return + + if (autoCompletePrefix.startsWith("@")) { + autoCompletePrefix = autoCompletePrefix.substring(1); + autoCompleteBeginPosition = text.substring(0, cursorPosition).lastIndexOf(" ") + 1 // 1 = space + autoCompleteModel = currentRoom.getUsers(autoCompletePrefix) + if (autoCompleteModel.length === 0) return + isAutoCompleting = true + autoCompleteEndPosition = cursorPosition + } } function replaceAutoComplete(word) {