zyedidia / micro

A modern and intuitive terminal-based text editor
https://micro-editor.github.io
MIT License
24.39k stars 1.16k forks source link

Fix inconsistent cursor movement behavior after mouse selection #3268

Closed dmaluka closed 2 months ago

dmaluka commented 2 months ago

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.

Together with @dustdfg 's fix #3091, this makes both keyboard and mouse selections work as expected. See also the discussion in #3091.

Fixes #3055