Sublime Forum

Scroll snap back when moving mouse away


On Windows, if you’re click-drag scrolling using a standard scrollbar (say, in file explorer), and you move the mouse about 50 pixels away horizontally from the scrollbar without letting up on the mouse button, the scroll position snaps back to its original location before scrolling began. If you move your mouse back into the 50 pixel range again, the scrollbar then snaps back to the new scroll position.

This allows you to “preview” scrolling to a new location, and then if you don’t want to actually scroll then, you can simply move your mouse out of the 50 pixel region and effectively cancel your scroll.

It would be great if Sublime supported this behavior (it’s a standard Windows thing, and I’m realizing I miss it in Sublime quite a bit when browsing source files).



This is something I didn’t add by design, as I personally find the behavior constantly frustrating: When I’m scrolling through a long file, at some point the mouse cursor has drifted too far away, and the file then snaps back unexpectedly.



Ah, shoot. Also, I noticed the “escape to cancel scroll” feature added in 2127. I’m not sure if that was added due to this post, but if so, cool, and thanks for that! However, it doesn’t cover the use case of “flipping back and forth” between two areas when browsing via scrolling (by moving the mouse horizontally in and out of the hotspot multiple times). That said, I’d love the feature as an option (especially so we can get a native feel on Windows), if you’d care to add it :smile:.



I would also really like this feature, I use it a lot when coding, i.e.:

Without releasing the left button:

  • Scroll to piece of code I want to eye-ball
  • Mouse-away to snap back to my original view
  • Mouse-back-in-range to eye-ball other code again
  • Release left button to stick to whichever view I want in the end.

I’m so used to this that I constantly lose my current scroll position, scrolling away not thinking I can’t get back… my work around is usually ctrl-Z, ctrl-Y (as I usually just changed code at the first position, but that’s ugly) (although I’m glad to hear about the “escape to cancel scroll” feature mentioned by jburnett below). It’s the behavior of every native toolbar on Windows and I believe there should at least be an option to have the Sublime Text toolbar behave this way as well for a more uniform UX on Windows.

I just started to use Sublime Text and I LOVE it, but this is missing.