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:
Start Emacs
Open scratch buffer (SPC b s)
Write two lines of text
Shift-V to visual-select one line and > to indent it
Escape to exit visual-line mode
Move to the other line, shift-V, >
Observed behaviour: :eyes: :broken_heart:
Line is indented but then cursor jumps to first line
Expected behaviour: :heart: :smile:
Line is indented and cursor stays put (preferably still in visual-line mode, but not too fussed either way)
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.
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:
If I press v and scroll through the pop-up, it seems like
g v
is bound toevil-visual-restore
, for which the doc is simply "Restore previous selection". Just runningevil-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 runningg 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