Faster scroll with mouse wheel + SHIFT held down


#1

In most applications I use under Linux, it’s possible to scroll faster with the mouse wheel when SHIFT is being held down.

I’m wondering if there’s a way to do this in Atom as well.


#2

I know I’m bumping this, but since it’s a single post (versus a long thread) I hope it’s ok. I’d really like the SHIFT+scroll wheel to scroll multiple lines or whole pages as well. I’d like to tack on the additional request for having ALT+scroll wheel to horizontally scroll. This fits in with other editors use of scroll wheel modifiers.

I’d be great if these features were native to Atom, but I’m not sure where to begin to make it an installable package even. I’ve temporarily hacked around it using an AutoHotKey script to implement the features, but a native solution would be much better.


#3

Bumping is when you post the minimal number of characters to the topic to push it to the top of the listing. Since you actually had something to say, it isn’t bumping and therefore welcome :grinning:

I’m not familiar with how the scroll wheel functionality works in Atom, so I’m not sure how it could be built into a package either. But, I am familiar with how to build a package, so if you need help there, let me know. You could look at how others have implemented various bits of mouse wheel support. Hopefully that would shine a light on things.


#4

I have this hack in minimap-element.js in the minimap package, which doubles the scroll speed when scrolling on the minimap (updated).

  relayMousewheelEvent (e) {
    // (delete or comment out original contents, add the following)
    atom.config.set('editor.scrollSensitivity', 80)
    this.getTextEditorElement().component.onMouseWheel(e)
    atom.config.set('editor.scrollSensitivity', 40)
  }

Finally, soution to actual question below, tested and working : )

This is text-editor-component.coffee, in atom/src, at line 420.

if event.shiftKey
  wheelDeltaY = wheelDeltaX
  wheelDeltaX = 0
else if event.altKey
  wheelDeltaX = wheelDeltaY
  wheelDeltaY = 0
if Math.abs(wheelDeltaX) > Math.abs(wheelDeltaY)
  # Scrolling horizontally
  previousScrollLeft = @presenter.getScrollLeft()
  updatedScrollLeft = previousScrollLeft - Math.round(wheelDeltaX * @scrollSensitivity)

  event.preventDefault() if @presenter.canScrollLeftTo(updatedScrollLeft)
  @presenter.setScrollLeft(updatedScrollLeft)
else
  # Scrolling vertically
  @presenter.setMouseWheelScreenRow(@screenRowForNode(event.target))
  previousScrollTop = @presenter.getScrollTop()

  if (event.shiftKey)
    amount = 2
  else
    amount = 1
  updatedScrollTop = previousScrollTop - Math.round(wheelDeltaY * (@scrollSensitivity * amount))

  event.preventDefault() if @presenter.canScrollTopTo(updatedScrollTop)
  @presenter.setScrollTop(updatedScrollTop)

#5

I am loving the super scroll speed on minimap hover. I have mine set to 160. Just wanted to thank you for this trick!


#6

So I’ve been continuing to work on this, since I understand not everyone is able to build atom. I finally got a package version working today, called quick-scroll, which is alt based. Just let’s you pick a speed and you scroll with mousewheel and alt.

Also thanks very much @octoxan, I’m glad you liked that minimap thing. It was a bit buggy actually but if you look up there you’ll see I changed it. Much faster, doesn’t randomly not work. ; )


#7

@refkotay Quick-Scroll not working in latest version of atom. People reported this on GitHub repo, but nobody addressed this.

Can we get a fix for latest version of atom?