Skip to content

Horizontal scroll for long lines#37

Merged
cloudmanic merged 3 commits into
mainfrom
horizontal-scroll
May 15, 2026
Merged

Horizontal scroll for long lines#37
cloudmanic merged 3 commits into
mainfrom
horizontal-scroll

Conversation

@cloudmanic

Copy link
Copy Markdown
Owner

Summary

  • Trackpad horizontal swipes and shift+wheel now scroll the editor's ScrollX, so long lines (Homebrew URLs, SHA strings, etc.) are reachable without dragging the cursor along
  • A muted / glyph at the leftmost / rightmost content cell signals off-screen content — without it a terminal user has no way to know horizontal scroll is available
  • Tree pane ignores horizontal wheel events; nothing useful to scroll there

Test plan

  • make test — race-detector run, all green locally
  • Open a Homebrew formula or wide config file, swipe trackpad horizontally — viewport shifts; appears at the right edge when content is cut off
  • Scroll right past column 0, confirm appears at the left edge
  • Move cursor with arrow keys past the visible window — viewport auto-follows (existing EnsureVisible behavior, regression-checked)
  • Lines that fit entirely in the viewport show neither glyph
  • Horizontal wheel over the file tree is a no-op (verify it doesn't blow up or shift state)

Wire up trackpad/shift-wheel horizontal scroll in the editor pane so
long lines like Homebrew formula URLs or SHA strings are reachable
without moving the cursor. A muted '<' / '>' glyph at the leftmost /
rightmost content cell signals when content extends off-screen — a
terminal has no scrollbar to convey this otherwise.

- Tab.ScrollH mirrors Tab.Scroll on the horizontal axis.
- app.scrollAtH dispatches WheelLeft/WheelRight inside the editor
  pane only (the tree has nothing useful to scroll horizontally).
- Tab.Render paints the overflow indicators after the per-row content
  loop using th.Muted so they read as affordances, not content.
Most terminals — including macOS Terminal and the common zellij/tmux
setups people SSH into — never emit native WheelLeft/WheelRight,
even when the trackpad swipe is horizontal. The vertical wheel event
just arrives with ModShift set instead, matching the VS Code
convention. Honor that as the primary path; keep the WheelLeft/Right
branch as a bonus for terminals that do support it.
Zellij — over both macOS Terminal and iTerm2 — splits shift+wheel into
two separate events: a ButtonNone+Shift 'modifier state' event, then
an unmodified WheelDown/Up. With the modifier dropped from the wheel
event itself, our previous check (ev.Modifiers()&ModShift) never saw
shift and the wheel scrolled vertically.

Track the wall-clock time of the most recent Shift-bearing event and
treat any wheel within 250ms as shifted. Verified end-to-end against
a captured event log from Zellij + macOS Terminal where the sequence
ButtonNone+Shift → WheelDown(none) appears reliably; the new
TestHandleMouse_ShiftStickyForWheel feeds that exact sequence.
@cloudmanic cloudmanic merged commit cad58bf into main May 15, 2026
2 checks passed
@cloudmanic cloudmanic deleted the horizontal-scroll branch May 15, 2026 23:41
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.

1 participant