on main help sign in
feat(bangmode): copy message result
f46387bKieran Klukas
internal/ui/chat/shell.go+5−2
@@ -152,9 +152,12 @@ func (s *ShellItem) HandleMouseClick(btn ansi.MouseButton, x, y int) bool {
152 return btn == ansi.MouseLeft
152 return btn == ansi.MouseLeft
153}
153}
154
154
155−// HandleKeyEvent implements KeyEventHandler for horizontal scrolling.
155+// HandleKeyEvent implements KeyEventHandler for copy and horizontal scrolling.
156func (s *ShellItem) HandleKeyEvent(key tea.KeyMsg) (bool, tea.Cmd) {
156func (s *ShellItem) HandleKeyEvent(key tea.KeyMsg) (bool, tea.Cmd) {
157− switch key.String() {
157+ switch k := key.String(); k {
158+ case "c", "y":
159+ text := "$ " + s.command + "\n" + s.output
160+ return true, common.CopyToClipboard(text, "Shell output copied to clipboard")
158 case "shift+left", "H":
161 case "shift+left", "H":
159 if s.xOffset > 0 {
162 if s.xOffset > 0 {
160 s.xOffset = max(0, s.xOffset-shellHScrollStep)
163 s.xOffset = max(0, s.xOffset-shellHScrollStep)