Browse Source

fix: pasting issue (#1182)

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

+ 5 - 1
packages/tui/internal/components/chat/messages.go

@@ -60,6 +60,10 @@ func (s selection) selecting() bool {
 	return s.startX >= 0 && s.startY >= 0
 }
 
+func (s selection) hasCompleteSelection() bool {
+	return s.startX >= 0 && s.startY >= 0 && s.endX >= 0 && s.endY >= 0
+}
+
 func (s selection) coords(offset int) selection {
 	// selecting backwards
 	if s.startY > s.endY && s.endY >= 0 {
@@ -127,7 +131,7 @@ func (m *messagesComponent) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
 		}
 
 	case tea.MouseReleaseMsg:
-		if m.selection.selecting() {
+		if m.selection.hasCompleteSelection() {
 			m.selection = selection{
 				startX: -1,
 				startY: -1,