fix: should also copy on `y` (additionally to `c`) (#1989)

Andrey Nering created

Change summary

internal/ui/chat/assistant.go | 2 +-
internal/ui/chat/tools.go     | 2 +-
internal/ui/chat/user.go      | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)

Detailed changes

internal/ui/chat/assistant.go 🔗

@@ -258,7 +258,7 @@ func (a *AssistantMessageItem) HandleMouseClick(btn ansi.MouseButton, x, y int)
 
 // HandleKeyEvent implements KeyEventHandler.
 func (a *AssistantMessageItem) HandleKeyEvent(key tea.KeyMsg) (bool, tea.Cmd) {
-	if key.String() == "c" {
+	if k := key.String(); k == "c" || k == "y" {
 		text := a.message.Content().Text
 		return true, common.CopyToClipboard(text, "Message copied to clipboard")
 	}

internal/ui/chat/tools.go 🔗

@@ -420,7 +420,7 @@ func (t *baseToolMessageItem) HandleMouseClick(btn ansi.MouseButton, x, y int) b
 
 // HandleKeyEvent implements KeyEventHandler.
 func (t *baseToolMessageItem) HandleKeyEvent(key tea.KeyMsg) (bool, tea.Cmd) {
-	if key.String() == "c" {
+	if k := key.String(); k == "c" || k == "y" {
 		text := t.formatToolForCopy()
 		return true, common.CopyToClipboard(text, "Tool content copied to clipboard")
 	}

internal/ui/chat/user.go 🔗

@@ -96,7 +96,7 @@ func (m *UserMessageItem) renderAttachments(width int) string {
 
 // HandleKeyEvent implements KeyEventHandler.
 func (m *UserMessageItem) HandleKeyEvent(key tea.KeyMsg) (bool, tea.Cmd) {
-	if key.String() == "c" {
+	if k := key.String(); k == "c" || k == "y" {
 		text := m.message.Content().Text
 		return true, common.CopyToClipboard(text, "Message copied to clipboard")
 	}