this post was submitted on 30 Nov 2023
0 points (50.0% liked)

Emacs

297 readers
1 users here now

A community for the timeless and infinitely powerful editor. Want to see what Emacs is capable of?!

Get Emacs

Rules

  1. Posts should be emacs related
  2. Be kind please
  3. Yes, we already know: Google results for "emacs" and "vi" link to each other. We good.

Emacs Resources

Emacs Tutorials

Useful Emacs configuration files and distributions

Quick pain-saver tip

founded 1 year ago
MODERATORS
 

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.

top 4 comments
sorted by: hot top controversial new old
[–] [email protected] 1 points 8 months ago

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.

[–] [email protected] 1 points 8 months ago (1 children)

I keep scrolling a 200 lines file by C-n and see CPU 50%, and by trackpad and see CPU 80%, is it normal?

[–] [email protected] 1 points 8 months ago

This package does nothing with C-n. Smooth scrolling at high speed can certainly take some CPU, nothing new there.

[–] [email protected] 1 points 8 months ago

I've used any scrolling mode before. When enable ultra-scrol-mac-mode, scrolling a 200 line buffer by C-n and CPU costs 50%. Scrolling by trackpad and CPU costs 80%. Is this normal?