From b2a8430fa2c532e1b280d06c6a7a504ff9b88cfc Mon Sep 17 00:00:00 2001 From: Tobias Fella Date: Mon, 28 Feb 2022 23:30:08 +0100 Subject: [PATCH] Don't apply autocompletion when autocomplete list is empty Fixes sending messages like ':)' --- imports/NeoChat/Component/ChatBox/ChatBar.qml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/imports/NeoChat/Component/ChatBox/ChatBar.qml b/imports/NeoChat/Component/ChatBox/ChatBar.qml index 62e0df1e1..31db77410 100644 --- a/imports/NeoChat/Component/ChatBox/ChatBar.qml +++ b/imports/NeoChat/Component/ChatBox/ChatBar.qml @@ -139,17 +139,14 @@ ToolBar { } function sendMessage(event) { - if (isCompleting) { + if (isCompleting && completionMenu.count > 0) { chatBar.complete(); - - isCompleting = false; - return; - } - if (event.modifiers & Qt.ShiftModifier) { + } else if (event.modifiers & Qt.ShiftModifier) { inputField.insert(cursorPosition, "\n") } else { chatBar.postMessage() } + isCompleting = false; } Keys.onReturnPressed: { sendMessage(event) }