Sublime Forum

How do I stop automatic horizontal scrolling when selecting to a shorter line?

#1

Here’s a video of what I’m talking about: https://imgur.com/lfPgJ0W

Whenever I’m trying to select text on a line that’s much longer than the surrounding ones, I’ll often accidentally move my cursor too far up/down, and the view scrolls all the way back to the left. Is there a way to stop this from happening? Basically, I want to disable horizontal scrolling while I’m actively making a selection.

I’ve made some of my own plugins and wouldn’t mind coding it, but I honestly can’t figure out a way to do it.

1 Like

#2

this is something that has often annoyed me too when selecting long lines using the mouse. I think I normally just turn on word-wrap temporarily, make my selection and continue - or use the keyboard instead of the mouse when I get frustrated.

I’m not sure it’s very possible with a plugin, there are no scroll events that could be listened to so one could cancel it or reset the position to what it was when the mouse selection was started… The only thing I can think of would be to pad the line above and below with spaces when starting a mouse selection, but that will affect undo history etc. so seems like an ugly solution to me. I’m curious to see what ideas other people will mention :slight_smile:

1 Like

Select line or paste a long string without scrolling to the end of that line
#3

The main challange I see is to detect accidentally moving cursor up/down too much vs. selecting multiple lines by intent.

In both cases however scrolling left only far enough to see the caret but no content of the following line is not very useful.

If viewport scrolls, I’d expect to see as much of the following line as possible.

Alternatively, if nothing of previous or following line is visible due to current horizontal scrolling position, automatic horizontal scrolling could be disabled, maybe by just selecting the current line up to eol and start selecting the next one not before moving cursor leftwards by a certain threadhold - which would indicate “select multiple lines by intent”.

0 Likes