Add horizontal scrollbar support with toggle functionality #1029
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds support for a horizontal scrollbar in the editor, allowing users to scroll horizontally when line wrapping is disabled and content extends beyond the viewport. The horizontal scrollbar can be toggled on/off via the command palette or keybindings, and its visibility is configurable through the editor config.
Key Changes
Horizontal Scrollbar Rendering: Added
render_horizontal_scrollbar()method to render a horizontal scrollbar at the bottom of each split pane. The scrollbar thumb position reflects the current horizontal scroll position (left_column).Layout Updates: Modified
SplitLayoutstruct to includehorizontal_scrollbar_rectand updatedsplit_layout()to calculate proper dimensions for both vertical and horizontal scrollbars, accounting for their visibility.Configuration Options: Added two new config options:
show_vertical_scrollbar(default: true) - controls vertical scrollbar visibilityshow_horizontal_scrollbar(default: false) - controls horizontal scrollbar visibilityToggle Actions: Implemented
toggle_vertical_scrollbar()andtoggle_horizontal_scrollbar()methods with appropriate status messages.Mouse Input Handling:
ScrollLeft/ScrollRightmouse eventsShift+ScrollUp/Downfor horizontal scrollingHorizontal Scroll Logic: Added
handle_horizontal_scroll()method that respects line wrap settings (no horizontal scrolling when wrapping is enabled).Command & Keybinding Support: Added new actions
ToggleVerticalScrollbarandToggleHorizontalScrollbarwith command definitions and menu items.Comprehensive E2E Tests: Added
horizontal_scrollbar.rstest suite covering:Notable Implementation Details
estimated_line_lengthconfig for calculating content widthCachedLayoutfor mouse hit testinghttps://claude.ai/code/session_016vmwKbd4BuvUJ34u6pViTi