diff --git a/imports/NeoChat/Component/ChatTextInput.qml b/imports/NeoChat/Component/ChatTextInput.qml index cbb026b86..36b2e66e4 100644 --- a/imports/NeoChat/Component/ChatTextInput.qml +++ b/imports/NeoChat/Component/ChatTextInput.qml @@ -34,6 +34,10 @@ ToolBar { position: ToolBar.Footer + function addText(text) { + inputField.insert(inputField.length, text) + } + contentItem: ColumnLayout { id: layout spacing: 0 @@ -235,6 +239,7 @@ ToolBar { room: currentRoom ?? null } + Layout.fillWidth: true @@ -296,13 +301,34 @@ ToolBar { Keys.onEscapePressed: closeAll() + Keys.onPressed: { + if (event.key === Qt.Key_PageDown) { + switchRoomDown(); + } else if (event.key === Qt.Key_PageUp) { + switchRoomUp(); + } else if (!(event.modifiers & Qt.ControlModifier)) { + event.accepted = true; + chatTextInput.addText(event.text); + chatTextInput.focus(); + return; + } + } + Keys.onBacktabPressed: { + if (event.modifiers & Qt.ControlModifier) { + switchRoomUp(); + return; + } if (isAutoCompleting) { autoCompleteListView.decrementCurrentIndex(); } } Keys.onTabPressed: { + if (event.modifiers & Qt.ControlModifier) { + switchRoomDown(); + return; + } if (!isAutoCompleting) { return; } diff --git a/imports/NeoChat/Page/RoomPage.qml b/imports/NeoChat/Page/RoomPage.qml index 0e7ada836..6e9b35c80 100644 --- a/imports/NeoChat/Page/RoomPage.qml +++ b/imports/NeoChat/Page/RoomPage.qml @@ -49,6 +49,11 @@ Kirigami.ScrollablePage { switchRoomDown(); } else if (event.key === Qt.Key_PageUp) { switchRoomUp(); + } else if (!(event.modifiers & Qt.ControlModifier)) { + event.accepted = true; + chatTextInput.addText(event.text); + chatTextInput.focus(); + return; } }