Skip to content

Conversation

@sinelaw
Copy link
Owner

@sinelaw sinelaw commented Feb 12, 2026

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 SplitLayout struct to include horizontal_scrollbar_rect and updated split_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 visibility
    • show_horizontal_scrollbar (default: false) - controls horizontal scrollbar visibility
  • Toggle Actions: Implemented toggle_vertical_scrollbar() and toggle_horizontal_scrollbar() methods with appropriate status messages.

  • Mouse Input Handling:

    • Added support for native ScrollLeft/ScrollRight mouse events
    • Added Shift+ScrollUp/Down for horizontal scrolling
    • Implemented click handling on horizontal scrollbar track to jump to position
  • Horizontal 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 ToggleVerticalScrollbar and ToggleHorizontalScrollbar with command definitions and menu items.

  • Comprehensive E2E Tests: Added horizontal_scrollbar.rs test suite covering:

    • Horizontal scrollbar visibility with long lines
    • Behavior with line wrapping enabled
    • Toggle functionality for both scrollbars
    • Config-based visibility settings
    • Split view scenarios

Notable Implementation Details

  • The horizontal scrollbar is only rendered when line wrapping is disabled; when wrapping is enabled, an empty track is shown
  • Scrollbar thumb size and position are calculated based on the ratio of visible width to total content width
  • The implementation respects the estimated_line_length config for calculating content width
  • Horizontal scrollbar areas are tracked in CachedLayout for mouse hit testing
  • Localization strings added for toggle actions and status messages

https://claude.ai/code/session_016vmwKbd4BuvUJ34u6pViTi

Add horizontal scrollbar at the bottom of each split view when line wrap
is disabled and content extends beyond the viewport width. Add toggle
commands for both vertical and horizontal scrollbar visibility with
config persistence, View menu checkbox items, and mouse interaction
(shift+scroll wheel, click/drag, native ScrollLeft/ScrollRight).

The scrollbar thumb is accurately sized by scanning actual buffer line
lengths, and all 12 new i18n keys are translated across all 14 locales.

Closes #972

https://claude.ai/code/session_016vmwKbd4BuvUJ34u6pViTi
@sinelaw sinelaw force-pushed the claude/add-scrollbar-toggles-pxkTu branch from 36a959b to 2a506f9 Compare February 12, 2026 22:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants