Maintain scrollbar position during resize #4886

Closed
opened 2026-01-30 23:59:11 +00:00 by claunia · 1 comment
Owner

Originally created by @egmontkob on GitHub (Nov 8, 2019).

Originally assigned to: @zadjii-msft on GitHub.

Description of the new feature/enhancement

Currently, if you drag back the scrollbar and then resize the window, the viewport jumps back to the "regular" position (the end of the data buffer, and the bottom position of the scrollbar).

It would be better to (approximately) maintain the scrolled position, so that the user keeps seeing whichever data was previously shown.

In VTE we usually track the position at the bottom of the viewport and try to keep that at the bottom; except when fully scrolled back to the top. More details in doc/rewrap.txt.

Originally created by @egmontkob on GitHub (Nov 8, 2019). Originally assigned to: @zadjii-msft on GitHub. <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 I ACKNOWLEDGE THE FOLLOWING BEFORE PROCEEDING: 1. If I delete this entire template and go my own path, the core team may close my issue without further explanation or engagement. 2. If I list multiple bugs/concerns in this one issue, the core team may close my issue without further explanation or engagement. 3. If I write an issue that has many duplicates, the core team may close my issue without further explanation or engagement (and without necessarily spending time to find the exact duplicate ID number). 4. If I leave the title incomplete when filing the issue, the core team may close my issue without further explanation or engagement. 5. If I file something completely blank in the body, the core team may close my issue without further explanation or engagement. All good? Then proceed! --> # Description of the new feature/enhancement Currently, if you drag back the scrollbar and then resize the window, the viewport jumps back to the "regular" position (the end of the data buffer, and the bottom position of the scrollbar). It would be better to (approximately) maintain the scrolled position, so that the user keeps seeing whichever data was previously shown. In VTE we usually track the position at the bottom of the viewport and try to keep that at the bottom; except when fully scrolled back to the top. More details in [doc/rewrap.txt](https://gitlab.gnome.org/GNOME/vte/blob/master/doc/rewrap.txt).
Author
Owner

@zadjii-msft commented on GitHub (Mar 13, 2020):

Okay I implemented this just now and WOW what a quality of life improvement this makes. Thanks for the great tip 😉 I ended up using the top of the viewport instead of the bottom, but that was mostly due to the fact that I already had code that would quickly locate the top's position in the reflowed buffer. Fortunatley, this makes the "fully scrolled back to the top" case really easy ☺️

@zadjii-msft commented on GitHub (Mar 13, 2020): Okay I implemented this just now and WOW what a quality of life improvement this makes. Thanks for the great tip 😉 I ended up using the top of the viewport instead of the bottom, but that was mostly due to the fact that I already had code that would quickly locate the top's position in the reflowed buffer. Fortunatley, this makes the "fully scrolled back to the top" case really easy ☺️
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#4886