Mouse-driven vertical scrolling idea #9607
Unanswered
gitmpr
asked this question in
Feature Requests, Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'd like to propose a feature idea based on some experiments I've been doing to improve high-speed buffer navigation.
Scrollbars have two great features:
However, they have one major drawback: you have to precisely grab the handle first. When there's a large amount of scrollback, the handle can become tiny and difficult to click, which slows down workflow.
My proposed solution is an optional extra configurable mouse scrolling mode by a user-defined key or mouse button.
While this binding is held, the terminal would scroll vertically based on the mouse's movement, mimicking the fluid, proportional control of a scrollbar handle without needing to grab it first.
I've created a proof-of-concept demonstrating the core functionality:
preview.mp4
Future Possibilities
This concept could be expanded with more advanced behaviors, such as:
This proof-of-concept is implemented currently only for Linux in the GTK layer and has only been tested on Wayland so far.
For the demo, the feature is hard-coded to the middle mouse button as a key bind to engage this scrolling method. The ideal implementation would be a fully configurable binding, which also changes the mouse icon while the button is being pressed.
You can find the code in my POC fork:
https://github.com/gitmpr/ghostty-mouse-scroll-feature
The core of the implementation is a dynamic sensitivity calculation that makes the scrolling feel intuitive regardless of the amount of text in the scrollback buffer.
When the scroll-mode is activated, it records the initial vertical position of the mouse cursor and the current scroll position.
As the mouse moves, it calculates the vertical distance (delta_y) from that starting point.
It then calculates a sensitivity factor by dividing the total scrollable range by the height of the terminal window. This makes the scrolling speed directly proportional to the size of the scrollback buffer.
The final scroll amount is determined by delta_y * sensitivity, creating a smooth and fast scrolling experience that scales naturally with the amount of content.
I believe a feature like this would be a powerful addition for users who deal with large amounts of terminal output. I'm very open to feedback and further discussion.
Beta Was this translation helpful? Give feedback.
All reactions