Skip to content

Support horizontal scroll #334

Closed

Description

@nnutter

I see the comment in the code,

revdiff/app/ui/mouse.go

Lines 175 to 176 in 0526193

// horizontal wheel is intentionally swallowed — horizontal scroll
// stays keyboard-driven so users keep a single mental model.

I'm still reporting the issue because I don't understand why if vertical scroll works then one would intentionally break horizontal scroll.

Activity

  1. umputun commented on Aug 28, 2026

    @umputun
    Owner

    you're right, and the comment in the code doesn't hold up. The wheel already doesn't mirror the keyboard on the vertical axis either, it pans the viewport while j/k move the cursor, which was a deliberate change in #173. So "single mental model" doesn't describe current behavior. The swallow and that comment both came in with the original mouse PR (#142) as a scope cut. Other deferred mouse interactions, including overlay item clicks, have since shipped, but neither the PR discussion nor the review established this rationale.

    so the ask is fair. The reason it isn't a two-line change is that horizontal scroll costs much more per event than vertical. The scroll offset is part of the render cache key, so every horizontal step throws away the whole per-line cache and forces a full re-render of the file. Each vertical event only moves YOffset, and any render it needs is coalesced to the end of the burst. A trackpad flick sends tens of events, so wiring horizontal straight through would re-create #179, where a fast scroll wedged the event loop. It needs burst handling first, and there's more than one defensible way to do that, so I want to prototype against a real gesture rather than pick one on paper.

    separately, your report exposed an unbounded keyboard offset: hold the right arrow long enough and it scrolls past the widest line, at which point every row cuts to nothing and the pane goes blank with no « to tell you why. #337 bounds that path. It adds no mouse support.

    which terminal and multiplexer are you in? Zellij currently consumes horizontal wheel events for terminal panes instead of forwarding them, so if that's your setup the gesture wouldn't reach revdiff even once it's implemented. On tmux they're forwarded from 3.3 onward.

    keeping this open.

  2. nnutter commented on Sep 2, 2026

    @nnutter
    Author

    Things are always complicated. =(

    I'm using Ghostty and Herdr. I forked at let AI try and it seems to be working (for me),

    https://github.com/nnutter/revdiff/blob/4e83c2d0ccafa392ba6bc45526edb2ec626479ae/app/ui/mouse.go#L174-L183

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions