Auto-hide terminal scroll bar fixes 2674
Closes #2674.
What changed
- read Ghostty's embedded
scrollbarconfig in the cmux host wrapper soscrollbar = neveris respected instead of always showing a vertical scroller - restore Ghostty's macOS overlay-scrollbar behavior when AppKit reports preferred scroller style changes, so the terminal grid width returns to the full overlay width instead of staying under a persistent legacy gutter
- flash the overlay scroller on hover when the system preference is legacy, matching Ghostty's usability fallback for mouse users
- refresh scrollbar appearance before terminal geometry is reconciled after Ghostty config reloads
- update the existing scrollbar-width regression to assert that preferred style changes restore overlay width rather than pinning the terminal under a visible gutter
Why
cmux embeds Ghostty but its forked GhosttySurfaceScrollView had drifted from Ghostty's macOS scrollbar behavior. That let a persistent right-side scrollbar gutter overlap the terminal's last column. This brings cmux back to Ghostty-style overlay behavior so the scrollbar only surfaces as an overlay instead of permanently occluding content.
Notes
- no local tests were run per repo policy
- verified the change builds successfully with the required tagged reload flow
[!NOTE]
Medium Risk
Touches terminal scroll view sizing and event handling, which can regress layout (grid width) or scrolling behavior across macOS scroller-style modes. Changes are localized to UI but affect a core interaction path.
Overview
Restores Ghostty-like macOS scrollbar behavior in the embedded terminal: reads Ghostty’s scrollbar config (honoring scrollbar = never), forces overlay scrollers (no reserved gutter), and re-syncs scroller appearance when system preferred scroller style changes.
Adds hover flashing for overlay scrollers when the system preference is legacy via a scroller tracking area, and refreshes scrollbar appearance before geometry reconciliation on config reload. Updates the existing regression test to assert overlay-width restoration after preferred scroller style changes.
Reviewed by Cursor Bugbot for commit c4a08fb222625ab347e58890e2aa2dbe441b7d46. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by cubic
Fixes terminal scrollbar occlusion by restoring macOS overlay scroller behavior in the embedded Ghostty view and honoring the scrollbar config (e.g., hides when scrollbar = never). This removes the permanent right gutter and keeps the last column visible.
- Bug Fixes
- Read
scrollbarfrom Ghostty config and hide the vertical scroller when set tonever. - Always use overlay scrollers and refresh on AppKit preferred-style changes to avoid reserving a gutter; retile only the scroll view.
- Flash the overlay scroller on mouse hover in legacy mode; add a tracking area to the vertical scroller.
- Sync scroller appearance during init and before geometry reconciliation on config reload.
- Update tests to assert overlay width is restored and rename the scroller-style test accordingly.
- Read
Summary by CodeRabbit
- New Features
- Introduced scrollbar visibility configuration option enabling system-default or always-hidden modes
- Enhanced scrollbar behavior with improved hover detection and responsive visibility feedback during interaction