+1

Selecting text: is there any rationale or "talk" behind Sublime's different approach compared to many other editors?

hced il y a 12 ans mis à jour par Sven Axelsson il y a 12 ans 4

I think (or rather feel) that Sublime Text's representation (and operation) of selecting text is a bit weird, compared to most other editors if not all of them.


For example, comparing Sublime Text to (oh, pick anyone) TextMate:


Holding Shift and pressing Down will place the cursor on the next line in ST2, compared to TextMate which does (what I'm used to) in fact highlight the current line leaving out the cursor.


This is my main barrier to entry (slight exaggeration since I love everything else in ST). Thus, I'm curious to know why it works like this and if text selection can be altered to (what I consider) normal behavior.

Not sure what you are talking about here. Is the difference you want to show that the cursor is visible at the end of the selection in Sublime text? I never even thought about that before. The behavior is still exactly the same as with other editors - pressing right arrow removes the selection with the cursor at the end, pressing left arrow removes the selection with the cursor at the start, typing replaces the selection. Or did you want to point out something else?

Sublime has a few distinctive deviations from common text editors that pertains to selecting text, cursor placement/movement. And in my case, this feels a bit weird. There's a lot to love about Sublime (it's even my preferred editor), but I still can't be friends with this (mainly due to old habits, I guess).


I'll use TextMate for comparison, but you can replace it with pretty much any editor out there (e.g. builtin TextEdit.app on Mac).


Note: I'm not saying either way is correct (see example). My point is that Sublime is different from what I'm used to in terms of the example below. So I have 2 questions. First, if I'm the only one who's thought about this. Secondly, why is it that Sublime chooses a different way – what's the rationale for introducing a different selections & cursor movement/placement scheme?


Example 1

-------------


Let's assume you have a text file containing the following:


line1

line2

line3

line4

line5


Sublime:


1. Place the cursor on beginning of line2.

2. Press arrow down while holding Shift key (selects the whole line and puts the cursor on line below).

3. Press arrow down.

…you end up on beginning of line4 (jumping from line2)!


TextMate:


1. Place the cursor on beginning of line2.

2. Press arrow down while holding Shift key (highlights the whole line and since you're having a selection, the cursor is not shown)

3. Press arrow down.

…you correctly end up on line3 (jumping from line2).

…too late to edit previous post, but, maybe I'm (actually) trying to imply that either way is correct, after all. :) (Until being enlightened, that is.)

Ah, ok. Sublime does indeed behave differently there. I don't know the rationale for the difference, but to me Sublime's behavior is perfectly logical. In your example, since you can see the cursor on line three in Sublime, it definitely makes sense it moves to line four when you press down again.


Maybe Jon can chime in and explain his thinking - perhaps this is the normal behavior under Linux?