Vim: dot to repeat gets confused if selection is from bottom up

Created on 2 Aug 2016  路  6Comments  路  Source: VSCodeVim/Vim

What did you do?

open any file with say 10 lines in it.
GV3j> This indents the correct three lines and leaving the cursor at line 7, now pressing . to repeat the indentation indents lines

quick demo here, each indent after the first one is just me pressing . to repeat the action
p7nkeopuih

What did you expect to happen?

The action should repeat over the same lines

What happened instead?

Technical details:

The command indents the correct number of lines but but remembers the "direction" of the selection so it indents the lines above the cursor

  • VSCode Version: 1.3.1
  • VsCodeVim Version: 0.1.4
  • OS: Windows 10 x64 latest updates
help wanted kinbug sizL

Most helpful comment

fixed in #2790

All 6 comments

The issue is that we need to emulate vim's behavior here more closely:

http://vimdoc.sourceforge.net/htmldoc/visual.html#visual-repeat

Hey all,

Has anyone started working on a fix for this, or at least has an idea about how it should be fixed?

I started looking at it (for me this is quite an inconvenience, I use this series of movements quite a lot), but so far I'm just getting familiar with the code base. 馃槂
I see that what causes the incorrect behavior is that when we press ., we first execute a CommandDot action, and that triggers the repeat of both the MoveUp and the IndentOperatorInVisualModesIsAWeirdSpecialCase. I'll try to investigate more to see how this could be fixed, but if you already have some pointers, that'd be great.

@markvincze I looked into fixing this a while back, and it's a little bit tricky. The fundamental problem is that we treat the dot operator much like a macro. When you press dot, we repeat the last actions that belong to the current operator. This is mostly stuff related to our concept of "history".

However, dot repeat on visual operators is supposed to repeat the same action on the same "amount of text". We don't have this concept currently coded, so it's a bit tricky.

Check :help visual-repeat for more info on the correct behavior.

Any update on this?

@Armour not from my side, I spent some time getting familiar with the code, but it was too involved and I didn't have more time to spend on it.

fixed in #2790

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rajinder-yadav picture rajinder-yadav  路  3Comments

triztian picture triztian  路  3Comments

st-schneider picture st-schneider  路  3Comments

liamdawson picture liamdawson  路  3Comments

stefanoio picture stefanoio  路  3Comments