ultra-scroll-mac: scroll like lightning
Emacs-mac is a beautiful port, and was the first to offer pixel-precise smooth scrolling nearly a decade ago. But with modern high-resolution trackpads and high density displays, I found its scrolling handlers just couldn’t keep up. On large, full-screen buffers in a heavy mode, trackpad scrolling verged on painful, and, maddeningly, was much worse in one direction than the other. And no wonder: modern trackpads deliver scroll events >50⨉ per second! The other key problem with all known smooth scrolling packages is they tend to stutter and loop back as you try to scroll across images taller than the window.
This package solves both of these problems:
- Scrolling performance has been increased 25-50⨉ — you move your fingers, the page responds, instantly.
- Large image handling has been worked around so you can scroll right across them without any hiccups.
- As a bonus, dumb mice get pretty good smooth(-ish) scrolling too.
I’ll be contributing the core scrolling functions upstream, so hopefully pixel-precision-scroll-mode
(which inspired this package, and is recommended on other builds) can make use of some of these improvements in the future.
Finally, this was all (to me) surprisingly hard to achieve, which you can read all about if you are a glutton.
I’ve used any scrolling mode before. When enable
ultra-scrol-mac-mode
, scrolling a 200 line buffer byC-n
and CPU costs 50%. Scrolling by trackpad and CPU costs 80%. Is this normal?Did you manage to get
pixel-scroll-precision-mode
to not snag on large images? It’s not clear from the README what improvements you’re planning to send upstream that are not mac-only.effectively simulates a feature-complete trackpad driver in elisp, complete with scroll interpolation, a timer-based momentum phase, etc.
I remember reading through this code when I was looking over pixel-scroll-precision and thinking “this is crazy”. The event loop is already full to bursting in a typical Emacs session.
I keep scrolling a 200 lines file by
C-n
and see CPU 50%, and by trackpad and see CPU 80%, is it normal?This package does nothing with
C-n
. Smooth scrolling at high speed can certainly take some CPU, nothing new there.