Sublime Forum

Cursor Caret should show at the end of \n newline instead of on next line


The cursor caret kind of shows itself at the next line when you make a selection. See the attached screenshot where you think that the selection is from Line 589 to 598 but instead you are looking at it visually wrong. You therefore sometimes push a up key and reduce the selection by 1 line and then end up selecting less than you should be.

It would be better if the cursor caret would show itself after the newline (at the end of a char place) instead of before at a char place. This would be after a \n and not at the beginning of the next line.

This is perhaps best visually seen. It is a visual difficulty to selecting what you want and making the wrong selection sometimes (in number of lines and selecting sections together like shown in the screenshot).



Isn’t after \n == the beginning of the next line?

\n is not visually see-able in ST… but we need a way to know a \n is selected or not.



What I propose is that the selection appears at the end of the little " " empty space that shows that a \n is selected there. The " " selection indicator is already there to indicate newline selected.

Note this is only in the case of selection - otherwise the caret shows up normally as is in non-selection display.
(In selection there isnt really a caret position anyways - it is just telling you on which side of the selection your region.a and region.b is)

Like the following mockup diagram:



So in the above screenshot, what’s selected in line 597 assuming that ST is implemented in your expectation? A space or a \n? I can’t distinguish them.

By the way, is there a editor behaving like that? Feel counter-intuitive to me.



On line 597 \n is selected. This is how SublimeText currently shows the selection of a newline.



Yes. But in your expectation, it could be either a space or a \n and both situations look like quite the same (blank things are selected and the cursors are in the same place for both situation).

I would have a hard time distinguishing these two while the cursor position tells a clear story.
image: space is selected
image : \n is selected



First mockup GUI is how I propose (second image is how it currently is).

This would be the introduction of a “special” selection caret.
NOTE: the caret only changes for selection state!