Add replyToFocusedOrLastMessage keybind (ctrl+Q)
This commit is contained in:
parent
66f9a17111
commit
d1d7bffc8f
|
@ -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"],
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user