emacs-evil / evil

The extensible vi layer for Emacs.
GNU General Public License v3.0
3.29k stars 276 forks source link

Evil shift left/right restore to the wrong region #1919

Closed kenkangxgwe closed 1 week ago

kenkangxgwe commented 2 weeks ago
  1. Use evil-20240619.63707
  2. Open an empty buffer and write down several random lines.
  3. Shift+V to select the line.
  4. > to indent the line.
  5. Repeat 3 and 4 on another line.

Excepted: The latter line shifts right Actual: The region is store to one of them, so both two lines shift right alternately.

tomdl89 commented 1 week ago

Hi @kenkangxgwe thanks for the issue. Unfortunately I can't repro. What major mode are you in when you do this? Are there any minor modes that might be interfering? Preferably you can give repro steps that start with a make emacs session, as this helps eliminate config / packages.

kenkangxgwe commented 1 week ago

Hi, I tried again and figured out that there's a Spacemacs configuration which remaps ">" to ">gv". Somehow it was working until recent changes in evil-visual-restore function.

From evil package's current implementation, after a user shifts the lines in visual mode, the mode will be changed to normal. I wonder if there's any plan to change this behavior so that the visual mode is kept and evil selection will also shift together with lines.

If there's no such plan, please close this issue and I will make changes in syl20bnr/spacemacs instead.

tomdl89 commented 1 week ago

I wonder if there's any plan to change this behavior so that the visual mode is kept and evil selection will also shift together with lines.

There's no plan to change this behaviour (unless there is an inconsistency with vim I'm missing).

But I would expect mapping > to >gv to still work, insofar as allowing indentation of a selection to be repeated. Indeed, manually typing > gv > from visual state does allow indenting twice, from what I can see. Feel free to reopen or open a new issue if there is a bug here.