Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2015 - arbitrary cursor position on empty line

Initial note: I'm not getting any responses over on superuser to my question, so please allow me to ask this here:

I inherited a VS solution with a bunch of unorthodox settings. I'm not at liberty to wipe out all those settings and start over. So there is 1 setting I want to change back to VS default but cannot find it.

In a normal/default VS c# environment, when you click the mouse on a line of code that hasn't been written yet (empty, no spaces, no code, no tabs), the cursor automatically positions to the beginning of where the line of code should begin. If it's just inside a foreach, if, or etc, it will indent a bit from the left edge according to tab rules, etc.

But in the weird VS settings I have, wherever I click, the cursor positions at that exact spot. So if I click on col 20 of the next line, the cursor remains at col 20 rather than auto-repositioning to col 5 or wherever it should be. This is SO annoying because I can't always eyeball where the cursor should be and I end up clicking at the end of the previous line, then hitting ENTER, at which time it goes to the next line and positions the cursor at the right place.

How can I fix this?

like image 985
HerrimanCoder Avatar asked Dec 28 '15 22:12

HerrimanCoder


2 Answers

It is controlled by the Enable virtual space option. See Visual Studio options - Text Editor - C#. By default it is off/unchecked.

like image 87
Sergey Vlasov Avatar answered Nov 15 '22 21:11

Sergey Vlasov


I resolved this issue by applying Sergey's suggested change (Visual Studio options -> Text Editor -> C# -> Enable Virtual Space [check]), but also enabled (Options -> Text Editor -> C# -> Tabs -> Smart).

like image 27
LordWilmore Avatar answered Nov 15 '22 21:11

LordWilmore