1

Re: u undoes too many entries in VS2008

I'm trying out viemu. I really like it but I have a problem with the undo using u.

I use resharper 4.1 and after making a large number of quick fixes on a file if a press u all my quick fixes are undone, not just the last one. This isn't a problem with Visual Studios ctrl-z. Please could you look into this?

Apart from this minor bug viemu seems to be an excellent product.

Mike

2

Re: u undoes too many entries in VS2008

Mike,

Thanks for the kind comment. I will look into this in the next few days -- I actually had to have a look at R# 4.1 compatibility issues. I'll post back here and send you an email as soon as I've had a chance to look at the problem.

Can you confirm whether the "quick fixes" you mention are a specific R# feature, or just regular editing? And whether this happens only with R# edits, or with any other non-vi change (say, edits using mouse drag and drop or toolbar buttons)?

Regards,

  -- Jon

3

Re: u undoes too many entries in VS2008

Hi Jon,

Quick fixes are a R# feature. When you place the cursor on a line of code that contains a compile error or warning resharper will prompt with a little "light bulb" that appears at the start of the line. Clicking this or pressing alt+enter will bring up a quick fix menu and allow you to select the change to make.

When this is combined with F12 for moving between warnings and errors in a file the number of changes racks up pretty fast.

Unfortunately pressing u to undo will actually undo all changes made this way instead of just the last one. Visual Studio's undo will correctly undo just the last one.

Please see here for more information on how ReSharper quick fixes work: http://www.jetbrains.com/resharper/features/code_analysis.html#Quick-Fixes

Hope this helps.

Mike

PS: It would be great for you to fix the auto entry of insert mode when renaming with ReSharper issue that is listed elsewhere. However I have found a work around to this by pressing s which allows me to enter edit mode. For some reason pressing i still leaves the editor in visual mode.

Last edited by mikedoherty (2009-02-13 13:35:19)

4

Re: u undoes too many entries in VS2008

Also is there any chance that you could modify the behavior of hjkl so that j and k can be used to move up and down the list of items in the intellisense prompt? It's irritating to have to switch back to the cursor keys. Alternatively there may be something else that I am missing?

Last edited by mikedoherty (2009-02-13 13:35:05)

5

Re: u undoes too many entries in VS2008

@mikedoherty,
There's a previous thread about intellisense navigation here: http://www.viemu.com/forums/viewtopic.php?id=524

6

Re: u undoes too many entries in VS2008

Thanks for the great explanation -- I will be able to look at this in the next few days.

On the other hand, using j/k for the Intellisense introduces some ambiguity, as you can still type in the presence of the drop-down box, but JP Boodhoo found a workaround using another tool (this one free) and configuring Alt-J/K for this. See his details here:

  http://blog.jpboodhoo.com/VSViEmuReSharperModdedWithAutoHotkey.aspx

Regards,

  -- Jon

7

Re: u undoes too many entries in VS2008

Thanks for these links both of you. I've got Auto Hot Key mapping alt+j and alt+k to intellisense up and down. It works a treat!

Jon, I look forward to hearing how you get on with the undo.

Regards,

Mike

8

Re: u undoes too many entries in VS2008

Mike,

I've had a look at this and I now understand what the problem is. Let me explain all the details so that we can try to work out what the right solution could be.

Since vim's idea of what a 'u' must undo is very different from VS's own, I needed to group actions for ViEmu's undo to emulate vim faithfully. For example, "c$hello" involves a deletion and some typing, and 'u' must undo this, while VS would consider both separate actions when undone with Ctrl-Z.

The problem with grouping is that, if you intersperse non-ViEmu actions in between ViEmu operations, they won't be grouped (neither VS nor R# or any other add-in will insert the ViEmu undo-group markers, which show up as "---" in the undo queue). Thus, in the absence of markers, ViEmu will consider them all a group, and undo them at once.

The grouping mechanism that ViEmu uses is based on markers, rather than begin/end grouping somehow, as I determined this to be the least problematic mechanism over the years. Believe me, VS's undo mechanism is not prepared for solid external usage like ViEmu requires.

Obviously, the way to solve this would be to add group markers to external actions, but I would need to determine a way to do this. Would adding a marker when a key is pressed be a good solution? Of course, only if there has been some kind of action performed! I think I would have to add a user setting for this and have it off by default, as it can be problematic in some cases, and I doubt many people will really want it.

I'll be happy to hear your thoughts on the issue, and I'll try implementing a test version of this after I get feedback on this.

Regards,

  -- Jon