From 54276b5118b1bc4679952b8a1f02f231503be318 Mon Sep 17 00:00:00 2001 From: Dmytro Maluka Date: Thu, 25 Apr 2024 02:08:16 +0200 Subject: [PATCH] Fix Deselect() after mouse selection Ensure that the selection start is always before the selection end, regardless of the direction of a mouse selection, to make h.Cursor.Deselect() handle its `start` argument correctly. This makes the cursor behavior after mouse selections consistent with the cursor behavior after keyboard selections. Fixes #3055 --- internal/action/actions.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/action/actions.go b/internal/action/actions.go index bccf72ae8..eafabe03f 100644 --- a/internal/action/actions.go +++ b/internal/action/actions.go @@ -113,7 +113,7 @@ func (h *BufPane) MouseDrag(e *tcell.EventMouse) bool { } else if h.doubleClick { h.Cursor.AddWordToSelection() } else { - h.Cursor.SetSelectionEnd(h.Cursor.Loc) + h.Cursor.SelectTo(h.Cursor.Loc) } h.Cursor.StoreVisualX()