Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to prevent Visual Studio editor from jumping up or down a line while selecting text?

Visual Studio 2015 on Windows 7 Pro SP1. When editing code in VS, most often when editing XAML because lines can get long. If you are dragging with the mouse to select text on a long line (the horizontal scroll bar in the editor is scrolled partially to the right) and your cursor moves slightly up or down, and the line above or below is shorter than the line you are selecting on, the editor snaps the horizontal scroll bar back to the left to show the beginning of that shorter line that is now (accidentally) included in the selection. This makes it impossible to actually complete the original selection since the text you were working on is no longer visible and is scrolled off to the right. If you keep the mouse button down and try to move back to the area of your original selection, the editor madly scrolls horizontally and vertically so quickly that there's no way to actually get back to where you were. So you must give up on that and go back and try again.

Is there any option to prevent this behavior? A less sensitive auto scroll or something? Usually I end up selecting by clicking at the start of what I want, scrolling the horizontal scrollbar to the right to see the end of what I want, then shift-clicking at the end of what I want. This is tedious when you're doing a lot of editing.

like image 871
twitort Avatar asked Nov 07 '22 11:11

twitort


1 Answers

Not that I know of (I wish there was though).

I have this same problem and my workaround is putting the cursor before the first word I want to highlight and hit CTRL + Shift + Right Arrow. This will highlight the first word. Then I hit the same button combination to highlight the next word then the next until I have highlighted everything I wanted to highlight.

If you want to be more precise, Shift + Right Arrow will select just the next character.

I hope this workaround helps you and is not tedious.

like image 103
Stryker Avatar answered Nov 23 '22 08:11

Stryker