Skip to content

Commit

Permalink
Fix Deselect() after mouse selection (#3268)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
dmaluka authored Apr 25, 2024
1 parent 1479438 commit 3f810c2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion internal/action/actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 3f810c2

Please sign in to comment.