syl20bnr / spacemacs

A community-driven Emacs distribution - The best editor is neither Emacs nor Vim, it's Emacs *and* Vim!
http://spacemacs.org
GNU General Public License v3.0
23.69k stars 4.9k forks source link

evil-visual-state-map "<" keybinding makes cursor jump #16573

Closed bmillwood closed 1 month ago

bmillwood commented 1 month ago

Description :octocat:

evil-visual-state-map "<" keybinding makes cursor jump to the location of the previous selection, which can be somewhere completely different in the document.

Reproduction guide :beetle:

Observed behaviour: :eyes: :broken_heart:

Expected behaviour: :heart: :smile:

Commentary

If I enter visual-line mode and press SPC SPC describe-key <, I get:

< runs the command (lambda nil (interactive) (progn (call-interactively
'evil-shift-left) (execute-kbd-macro "gv"))) (found in evil-visual-state-map),
which is an interactive Lisp function.

If I press v and scroll through the pop-up, it seems like g v is bound to evil-visual-restore, for which the doc is simply "Restore previous selection". Just running evil-shift-left in visual mode (e.g. by rebinding the key) exits me from visual mode, and I wonder if the point here is to keep me in the same visual mode, and indeed running g v after the rebound key does put me back in the "correct" visual mode. Perhaps what's happening here is that the "gv" keyboard macro is being run before the "previous" selection has been updated to the current one?

I'm working around this by rebinding those keys, but I can't imagine this behaviour is deliberate. I think I reproduced it on a fresh Spacemacs install with default options, but it's possible my install was somehow not entirely fresh.

System Info :computer:

Backtrace :paw_prints:

not relevant

fnussbaum commented 1 month ago

Thanks for the thorough report! Should be fixed in https://github.com/syl20bnr/spacemacs/pull/16574.