📜 ⬆️ ⬇️

Context menus VS2010 / 2012 and keyboard

As a developer, I spend a lot of time in Visual Studio. And, I must say that most of the time, Visual Studio is fine with me. But sometimes there are not very pleasant moments. One of these problems that has been bothering me for a long time is that the context menus in VS2010 work a bit differently than in VS2005 / 2008. And in VS2012 this situation has not changed.

So what are these differences? It so happened that when working in Visual Studio, I mostly use the keyboard. And I also open the context menus in the code editor from the keyboard - using the corresponding key (Apps key). In addition, I have long been accustomed to using some kind of keyboard patterns, and I use them without thinking.

In VS2008, the position of the mouse cursor did not affect the keyboard shortcut menu navigation. And I was sure that the sequential pressing of the “Apps, Down, Down, Enter, Up, Enter” keys will always call the “Organize Usings> Remove and Sort” function:
')
image

But in VS2010 this behavior has changed! If the mouse cursor is located above the opened context menu, the item above which it is located immediately becomes active. Accordingly, the sequence “Apps, Down, Down, Enter, Up, Enter” does not always lead to the desired result.

And sometimes the result may not be very pleasant. When using Visual SVN in some cases, the above sequence of button presses can call the “Revert whole file” function!

image

This is not fatal, the Undo function restores all changes, but this behavior of Visual Studio is annoying.

In Visual Studio 2012, the context menus behave a little differently, but the essence remains the same - the position of the mouse cursor still affects their work, and this behavior still prevents them from working.

I tried to find out if this could be changed in Visual Studio, but I could not quickly find a solution. Then I went ahead and wrote a small utility that fixes this problem. This utility keeps track of pressing the Apps key, and if this key is pressed in Visual Studio, it simply moves the mouse cursor to the upper border of the screen before the context menu is opened.

The compiled version and source code can be found here:

http://code.google.com/p/vs-ctx-menu-fix/downloads/list

The utility works in Windows 7 and Windows 8 x64. I wrote the first version in January 2011, now I just updated it to work with Visual Studio 2012.

I hope that this utility will be useful not only for me! :)

Source: https://habr.com/ru/post/157389/


All Articles