Sublime Forum

Double-click on a word and subsequent caret position

#1

Hello Sublimetexters.

I’m quite used to double-click to select words in my code, and often to select multiple words with, obviously, multiple carets.
There’s one behaviour that annoys me a little: sometimes the caret rests at the left of the selected word, sometimes on the right. This is particularily bad, to me, in the case of the multiple selections with mixed left-right positions. My expectation is the caret always on the right of the selection, at the end of the word; the unwanted position is the cursor at the beginning of the selection.

I tried a lot but I cannot find a solid repeatable pattern to double-click and have the caret resting on the left; it seems that a subtle mouse movement between the first and the second click makes it more likely to happen, but not 100% of the times. And sometimes I’m pretty sure it happens with no mouse movement.

I’m the only one experiencing this? Any ideas?

I see this behaviour on Debian Buster Bullseye running KDE and Kubuntu 20.04.

0 Likes

#2

Once you have selected all regions of interest, you can press the left arrow key and then ctrl+right-arrow-key to force all carets to the right side.

0 Likes

#3

The end of the selection that the cursor ends up on when you double click to select depends on the direction that the mouse is moving in after the second click (when the selection is established) and before you let go of the mouse button. So, depending on how you’re grabbing selections, you may be moving in one direction or the other inadvertently.

sublime_selection

In either case the text is still selected, so if you want to type to overwrite, paste to replace or copy, you still end up with the same text regardless, and as @rwols pointed out you can also press left or right after you’re done selections to jump the cursors to that end of the selection if you want to be positioned for other edits.

As seen above, if you hold the mouse button down when you select, you can ensure that the cursor ends up where you want (though of course you need to be careful to keep the mouse inside of the selection or you may extend it in ways you didn’t intend.

1 Like

#4

Ooooh now I understand, I’d never figured this out by myself.
It seems to me a feature that leverages on too much mouse ability, but now I know my enemy :slight_smile:
rwols and OdatNurd, Thanks a lot.

0 Likes

#5

I tried a lot, but I cannot find a use for this feature. I wind up, a lot of times, with the caret in an unexpected position, even while selecting text in the most common fashion, from top to bottom. It requires me to repeat the selection or make unwanted keypresses to set things the way I like.

I’m sorry but to me this feature is unnecessarily smart.

There’s a way to disable this behaviour, going back to what it was before or, even better, to have the caret always at the end of every selected region?

0 Likes

#6

This behavior dates all the way back to 2010, though there have been some refinements in build 4114 that may help you.

0 Likes

#7

Really?

I’ll try an older ST version. I don’t know why this feature started bothering me only recently. I found no difference in version 4114.

Thanks.

0 Likes

#8

I installed ST 4102 (just the oldest I still have lying around) and this feature isn’t present, at least this is what I can observe. The caret is always on the closest character to the mouse pointer while selecting text, there is no caret placement based on the horizontal position of the pointer. What is changed about this between 4102 and 4114?

0 Likes

#9

Build 4114 has made some changes, but otherwise there haven’t been any functional changes since its inception.

0 Likes