@@ -152,9 +152,12 @@ func (s *ShellItem) HandleMouseClick(btn ansi.MouseButton, x, y int) bool {
152152 return btn == ansi.MouseLeft
153153}
154154
155−// HandleKeyEvent implements KeyEventHandler for horizontal scrolling.
155+// HandleKeyEvent implements KeyEventHandler for copy and horizontal scrolling.
156156func (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")
158161 case "shift+left", "H":
159162 if s.xOffset > 0 {
160163 s.xOffset = max(0, s.xOffset-shellHScrollStep)