Skip to content

Commit

Permalink
Fix Deselect() after mouse selection
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 zyedidia#3055
  • Loading branch information
dmaluka committed Apr 25, 2024
1 parent 24406a5 commit 54276b5
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 54276b5

Please sign in to comment.