Skip to content

The open source coding agent.

TypeScript

fix: mouse text selection bug (#1206)

Aiden Clinee4f754eee7b4
diff --git a/packages/tui/internal/components/chat/messages.go b/packages/tui/internal/components/chat/messages.go
index 4a4a79a1dba..cbea349ca70 100644
--- a/packages/tui/internal/components/chat/messages.go
+++ b/packages/tui/internal/components/chat/messages.go
@@ -520,9 +520,9 @@ func (m *messagesComponent) renderView() tea.Cmd {
prefix := ansi.Cut(line, 0, left)
middle := strings.TrimRight(ansi.Strip(ansi.Cut(line, left, right)), " ")
- suffix := ansi.Cut(line, left+len(middle), width)
+ suffix := ansi.Cut(line, left+ansi.StringWidth(middle), width)
clipboard = append(clipboard, middle)
- line = prefix + styles.NewStyle().Background(t.Accent()).Foreground(t.BackgroundPanel()).Render(ansi.Strip(middle)) + suffix
+ line = prefix + styles.NewStyle().Background(t.Accent()).Foreground(t.BackgroundPanel()).Render(middle) + suffix
}
final = append(final, line)
}