In Eclipse, virtual space (the possibility to place the caret after the end of a line) is disabled by default, which is contrar开发者_高级运维y to IntelliJ IDEA default setting. http://www.jetbrains.com/idea/documentation/migration_faq.html
Is there a particular reason why you would want to place the caret after the end of the line? I'm trying to think of a use-case for it but can't come up with any...
The reason I ask because it is the default setting in IntelliJ which makes me curious.
For me as an old programmer this question is really weird. The question ought to be why so many new editors don't offer this age old feature. (Together with block/rectangular editing).
Simply put, I want to be able to move around my text in any way, not being restricted to where someone has typed before. The screen represents a rectangular image of a piece of text (think metaphores here etc). I expect to be able to go anywhere within this rectangular space without being stopped by how the underlying file looks.
Example: If we have three lines of text:
Line1: This is a long line with lots of text in it.
Line2: This is a shorter line.
Line3: This is a third line with text.
If I am at the end of line 2 and want to navigate to the end of line 1 I want to be able to go right (a number of times) and then up, which is one way to do it in virtual space, but in the new kind of editors (which behave in a very old file-centric way) if I press right at the end of line 2 I will end up at the beginning of line 3. What's the point of that? Of course that mimics a "step forward" in the file, but metaphorically I wanted to go somewhere else.
I really think this is a quite backwards way to go.
And as an end point - this is symtomatic of many (young?) programmers who haven't seen so many operating systems and editors from before, some of which were not at all worse than todays systems. Linux/Unix is not the world, there were many better systems that we could learn from.
I was waiting for someone to answer this question. This is a really interesting question and I was hoping some old timer will answer it... (Since I cannot clearly Understand it either...) The following is an excerpt from Visual Studio Tips.
"Okay. Virtual space is a little funky to understand if you aren't from the Old School. You see, a loooooong time ago in this galaxy we used to have (and some people still have) editors that treat everywhere as editable space. Let me explain: Without virtual space on the line ends where the code ends. Now you can have some really long lines of code but, until you press Enter, the line just keeps on going.
If I move my cursor to the end of any of these lines and hit my Right Arrow key then it will go to the next line. So, for the short line the cursor will jump down to the next line at column 44. For the longer line it will jump down the next line at column 68. And for the super duper long line it will jump to the next line at column 176. This is the way editors have been for a while now and isn't really new to folks.
However, this way wasn't always the case. There was a time when you could type anywhere you wanted any time you wanted without restriction. Some text editors still do this today. Virtual space allows you to go back to the old style of editing which is preferred by some coders. Go to Tools -> Options -> Text Editor -> All Languages -> General -> Settings and check the "Enable virtual space" checkbox to turn this feature on. When you do, you will be able to type anywhere on a line regardless of whether the code ends or not:"
Virtual space gives you more freedom in treating your source code as a two-dimensional matrix of characters, rather than like flowing lines of text.
This is very helpful if you happen to like aligning certain things on the same column.
Also, many people (me included) like to use block editing whenever possible. Block editing relies heavily on block selection. In Intellij block selection is achieved by holding down Alt
while dragging the mouse. If you do not have the Allow placement of caret after end of line
option checked in Intellij, you will find that block selection and editing is much harder. The tendency of the editor to place the caret at the end of a line rather than at the precise spot where you clicked makes block editing more difficult than it ought to be.
In any case, having virtual space enabled should not really be a problem to anyone. If your caret ends up beyond the end of the current line, and you want it at the end, all you need to do is press the End
key.
It makes lining up end-of-line comments/code easier, or in non-code, columnar data/etc. Under some circumstances it saves a lot of hassle.
I have it off by default, despite bring a relatively old programmer who started off with canvas-style editors (as opposed to line-style).
精彩评论