Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dot to repeat gets confused if selection is from bottom up #549

Closed
Paxxi opened this issue Aug 2, 2016 · 6 comments
Closed

dot to repeat gets confused if selection is from bottom up #549

Paxxi opened this issue Aug 2, 2016 · 6 comments

Comments

@Paxxi
Copy link
Contributor

Paxxi commented Aug 2, 2016

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
@Chillee
Copy link
Member

Chillee commented May 4, 2017

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

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

@markvincze
Copy link

markvincze commented Dec 22, 2017

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.

@Chillee
Copy link
Member

Chillee commented Dec 23, 2017

@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.

@Armour
Copy link

Armour commented May 3, 2018

Any update on this?

@markvincze
Copy link

@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.

@xconverge
Copy link
Member

fixed in #2790

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants