From 3f810c24d231daaee00239a919feb415e864653f Mon Sep 17 00:00:00 2001 From: Dmytro Maluka Date: Thu, 25 Apr 2024 21:58:40 +0200 Subject: [PATCH] Fix Deselect() after mouse selection (#3268) 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 a8022337..883f8208 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()