Add replyToFocusedOrLastMessage keybind (ctrl+Q)

This commit is contained in:
miruka 2020-05-20 06:51:26 -04:00
parent 66f9a17111
commit d1d7bffc8f
2 changed files with 29 additions and 0 deletions

View File

@ -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"],

View File

@ -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