feat: copy message to clipboard using keybinding (#80)
* copy message * default keybinding Co-authored-by: chromium <chromium@chromium.codes>
This commit is contained in:
parent
e4f0812bd1
commit
f6061df298
2 changed files with 13 additions and 0 deletions
|
|
@ -23,6 +23,7 @@ type keybindings struct {
|
|||
SelectLastMessage string `toml:"select_last_message"`
|
||||
ReplySelectedMessage string `toml:"reply_selected_message"`
|
||||
MentionReplySelectedMessage string `toml:"mention_reply_selected_message"`
|
||||
CopySelectedMessage string `toml:"copy_selected_message"`
|
||||
}
|
||||
|
||||
type theme struct {
|
||||
|
|
@ -107,6 +108,7 @@ func loadConfig() *config {
|
|||
SelectLastMessage: "End",
|
||||
ReplySelectedMessage: "Rune[r]",
|
||||
MentionReplySelectedMessage: "Rune[R]",
|
||||
CopySelectedMessage: "Rune[c]",
|
||||
}
|
||||
c.Borders = tview.Borders
|
||||
|
||||
|
|
|
|||
11
ui.go
11
ui.go
|
|
@ -197,6 +197,17 @@ func onMessagesViewInputCapture(e *tcell.EventKey) *tcell.EventKey {
|
|||
messageInputField.SetTitle("[@] Replying to " + m.Author.String())
|
||||
app.SetFocus(messageInputField)
|
||||
return nil
|
||||
case conf.Keybindings.CopySelectedMessage:
|
||||
hs := messagesView.GetHighlights()
|
||||
if len(hs) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
m := findByMessageID(hs[0])
|
||||
err := clipboard.WriteAll(m.Content)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
return e
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue