Aiden Cline 7 mesiacov pred
rodič
commit
cef5c29583

+ 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,