diff --git a/src/backend/user_files.py b/src/backend/user_files.py index fe996fc6..68f23fbf 100644 --- a/src/backend/user_files.py +++ b/src/backend/user_files.py @@ -321,6 +321,7 @@ class UISettings(JSONDataFile): "toggleSelectMessage": ["Ctrl+Space"], "selectMessagesUntilHere": ["Ctrl+Shift+Space"], "removeFocusedOrSelectedMessages": ["Ctrl+R", "Alt+Del"], + "replyToFocusedOrLastMessage": ["Ctrl+Q"], # Q for Quote "debugFocusedMessage": ["Ctrl+Shift+D"], "clearRoomMessages": ["Ctrl+L"], diff --git a/src/gui/Pages/Chat/Timeline/EventList.qml b/src/gui/Pages/Chat/Timeline/EventList.qml index c0c7d6ba..b9c8c167 100644 --- a/src/gui/Pages/Chat/Timeline/EventList.qml +++ b/src/gui/Pages/Chat/Timeline/EventList.qml @@ -96,6 +96,34 @@ Rectangle { } } + HShortcut { + sequences: window.settings.keys.replyToFocusedOrLastMessage + onActivated: { + let event = eventList.model.get(0) + + if (eventList.currentIndex === -1) { + // Find most recent event that wasn't sent by us + for (let i = 0; i < eventList.model.count; i++) { + const potentialEvent = eventList.model.get(i) + + if (potentialEvent.sender_id !== chat.userId) { + event = potentialEvent + break + } + } + } else { + event = eventList.model.get(eventList.currentIndex) + } + + if (! event) return + + chat.replyToEventId = event.id + chat.replyToUserId = event.sender_id + chat.replyToDisplayName = event.sender_name + } + } + + HShortcut { active: eventList.currentItem sequences: window.settings.keys.debugFocusedMessage