diff options
author | Nicolas Werner <nicolas.werner@hotmail.de> | 2021-02-24 23:51:05 +0100 |
---|---|---|
committer | Nicolas Werner <nicolas.werner@hotmail.de> | 2021-02-24 23:51:05 +0100 |
commit | f6b5b24d64813f915fa05517ae9e5a19273669bf (patch) | |
tree | bf7c79e6c4667b379276fa86f84e84e8d0415bf9 /resources/qml/MessageInput.qml | |
parent | Ensure we ask for confirmation when clicking on a matrix uri (diff) | |
download | nheko-f6b5b24d64813f915fa05517ae9e5a19273669bf.tar.xz |
Allow editing via up and down arrows
Diffstat (limited to 'resources/qml/MessageInput.qml')
-rw-r--r-- | resources/qml/MessageInput.qml | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/resources/qml/MessageInput.qml b/resources/qml/MessageInput.qml index c855ef90..9bb01471 100644 --- a/resources/qml/MessageInput.qml +++ b/resources/qml/MessageInput.qml @@ -209,6 +209,39 @@ Rectangle { } else if (event.key == Qt.Key_Down && popup.opened) { event.accepted = true; popup.down(); + } else if (event.key == Qt.Key_Up) { + if (cursorPosition == 0) { + event.accepted = true; + var idx = TimelineManager.timeline.edit ? TimelineManager.timeline.idToIndex(TimelineManager.timeline.edit) + 1 : 0; + while (true) { + var id = TimelineManager.timeline.indexToId(idx); + if (!id || TimelineManager.timeline.getDump(id, "").isEditable) { + TimelineManager.timeline.edit = id; + cursorPosition = 0; + break; + } + idx++; + } + } else if (cursorPosition == messageInput.length) { + event.accepted = true; + cursorPosition = 0; + } + } else if (event.key == Qt.Key_Down) { + if (cursorPosition == 0) { + event.accepted = true; + cursorPosition = messageInput.length; + } else if (cursorPosition == messageInput.length && TimelineManager.timeline.edit) { + event.accepted = true; + var idx = TimelineManager.timeline.idToIndex(TimelineManager.timeline.edit) - 1; + while (true) { + var id = TimelineManager.timeline.indexToId(idx); + if (!id || TimelineManager.timeline.getDump(id, "").isEditable) { + TimelineManager.timeline.edit = id; + break; + } + idx--; + } + } } } background: null |