commit 4edb6ca
sewn
·
2026-07-28 19:15:45 +0000 UTC
parent 5f7dc12
Add Control+y to copy selected message
3 files changed,
+11,
-0
M
app.go
+3,
-0
1@@ -913,6 +913,8 @@ func (app *App) handleAction(action string, args ...string) {
2 app.win.SelectMessagePrevious()
3 case "message-select-next":
4 app.win.SelectMessageNext()
5+ case "message-copy":
6+ app.win.CopySelectedMessage()
7 case "toggle-topic":
8 app.win.ToggleTopic()
9 case "toggle-channel-list":
10@@ -992,6 +994,7 @@ var defaultCommands = map[string][]string{
11 "Control+p": {"buffer-previous"},
12 "Control+Up": {"message-select-previous"},
13 "Control+Down": {"message-select-next"},
14+ "Control+y": {"message-copy"},
15 "Alt+Right": {"buffer-next"},
16 "Shift+Right": {"buffer-next-unread"},
17 "Control+Right": {"cursor-right-word"},
+2,
-0
1@@ -266,6 +266,8 @@ shortcuts {
2 : select the previous message in the timeline
3 | message-select-next
4 : select the next message in the timeline
5+| message-copy
6+: copy the selected message to the system clipboard
7 | toggle-channel-list
8 : show/hide the vertical channel list
9 | toggle-member-list
M
ui/ui.go
+6,
-0
1@@ -354,6 +354,12 @@ func (ui *UI) SelectedMessage() *Line {
2 return ui.bs.Selected()
3 }
4
5+func (ui *UI) CopySelectedMessage() {
6+ if line := ui.bs.Selected(); line != nil {
7+ ui.vx.ClipboardPush(line.Body.string)
8+ }
9+}
10+
11 func (ui *UI) Click(x, y int, event vaxis.Mouse) {
12 for _, ev := range ui.clickEvents {
13 if x >= ev.xb && x < ev.xe && y == ev.y {