Browse Source

fix: mouse text selection bug (#1206)

Aiden Cline 7 months ago
parent
commit
e4f754eee7
1 changed files with 2 additions and 2 deletions
  1. 2 2
      packages/tui/internal/components/chat/messages.go

+ 2 - 2
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)
 			}