-1

On Selecting Multiple Lines

hced 13 ár síðan Uppfært 12 ár síðan 3

I have a small quibble with the way you select multiple lines of text in Sublime – or technically, how you see/perceive what's been selected when doing so.

Let's say you have these example lines below (throw in a couple empty lines above and below) …

Maecenas faucibus mollis interdum.
Aenean lacinia bibendum nulla sed consectetur.
Nulla vitae elit libero, a pharetra augue.

… To reproduce the behavior I'm referring to, please follow these steps:

1. Place the cursor on the beginning of the first line, right before the 'M' (in "Maecenas").
2. Press and hold Shift, then press Arrow Down 3 times.

The cursor lands on the line below the selected lines.

Compare with e.g. Vim's Visual Line selection (pressing capital V in normal mode). I'm hoping for Sublime Text to have the same behavior as when selecting Visual Line in Vim – which is also default in the vast majority of editors and places where you can edit and select text, i.e:

Highlighting only the lines you've selected and momentarily not showing the cursor.

So, my questions are:

- What is the motivation to employ this behavior of selecting multiple lines of text in Sublime?

- Is there a way to switch the behavior into the one that I (personally) am more used to?

I'm posting a reference image that shows the behavior in a few editing environments:

Image 7

Sidenote: also, in Sublime Text, when selecting in the opposite direction (Shift-Arrow Up) it doesn't leave the cursor alone on the line above the selection. I think this holds some ground for my proposal to adapt Sublime to a more consistent behavior.

Reason for my personal preference towards the more common behavior is, well, because I'm more used to it (from editors like TextMate). In Sublime, it feels slightly more confusing when selecting, copying and pasting multiple lines of code. I believe I *can* get used it, though, and this is not a be-all and end-all issue, but it would be nice if it was possible to accommodate for people like me, who prefer the standard way, if I may call it such.

Regardless of what, in a broad perspective, I'm of course immensely pleased with Sublime Text!

Showing the cursor as you describe in Sublime is helpful in some respects. For example, it helps to indicate when you have end-of-line characters included in your selection; Shift-Down a few times to an empty line then Shift-Left to see this. Conceptually, I always think of it as the insertion point and this makes sense in the context of selection.


I think the main reason for this behavior, though, is Sublime's multi-cursor/multi-selection functionality. For example, Shift-Down a few times then Ctrl-Shift-L (Selection->Split Into Lines). Observe that you now have multiple cursors/selections and can operate on them simultaneously. In this situation, showing the cursor with its selection is a big help (and I would argue a near necessity). Having the cursor hidden (only) during a single-block selection would be inconsistent with this.


joelpt: Thanks for helping me trying to grok this. Re-reading my comments, I regret to say I'm not entirely sure I understand all of it myself (duh, but it's complicated to explain). What I do know is that something is, or feels, different. Basically it boils down to that cursor's placement when doing line selections via Shift-Up/Down.


Let's say you have a document containing 4 lines of text including the 3 aforementioned ipsum lines and an extra line below that paragraph. After pressing Shift-Down three times from beginning of the word "Maecenas": why is the cursor placed on the line below (line 4) and not the end of line 3, right after the "augue" word? Apparently this must be only me, but, I guess the essence of what I'm trying to say is that, if you press Shift-Down three times, it should highlight/select three lines and place the cursor by the end of line 3 (as it would if my example document had only 3 lines). It seems to me that Sublime differs from all other editors in this regard. (I could be totally wrong. Who knows, maybe Sublime is the only one doing it right!)

Another side effect, which is affected by this:


If you are at the beginning of a line and press Shift-Down, the entire line is highlighted/selected (which is fine).

But when you are at the beginning of the last line in the document and press Shift-Down, nothing happens.


Similarly:


If you are at the end a line and press Shift-Up, that entire line is highlighted/selected (which is fine).

But when you are at the end of the first line in the document and press Shift-Up, nothing happens.


I think there's a consistency drawback here. I know you can select the whole line with e.g. Shift-Cmd-Left/Right, but for those who are accustomed with standard ways of selecting text, this may feel a bit odd.


Coming from TextMate, I'm used to the way the cursor acts in this environment. That said, I do know that changing the way the cursor acts in Sublime Text might be dangerous. I just felt like bringing this up, to see what others think.