Skip to content

feat(ui): scroll the reference badges instead of cropping them - #49

Merged
LeadcodeDev merged 1 commit into
mainfrom
feat/scrollable-reference-badges
Aug 29, 2026
Merged

feat(ui): scroll the reference badges instead of cropping them#49
LeadcodeDev merged 1 commit into
mainfrom
feat/scrollable-reference-badges

Conversation

@LeadcodeDev

Copy link
Copy Markdown
Collaborator

A commit carrying more references than the subject column is wide lost the last of them. The cell is one h_flex with overflow_hidden, so badges past the edge were simply not drawn — and the subject with them. On this repository's tip, six refs left no subject visible at all.

The change

The badges move into a strip of their own that scrolls horizontally, capped at half the cell so the subject always keeps its share. Nothing draws a scrollbar: the strip scrolls under the trackpad and shows no chrome.

┌─ Subject ──────────────────────────────────────┐
│ [fix/histo…][flicker-1][flicker-2]  fix(app):… │
│  ◄─── trackpad ───►                            │
└────────────────────────────────────────────────┘

Three things that are not obvious

restrict_scroll_to_axis is not optional, and not what the name suggests. It defaults to false, and with it unset a scrollable-x element treats a vertical delta as horizontal whenever its own y overflow is not Scroll (gpui/src/elements/div.rs:3221). A vertical gesture anywhere over a badge strip would have scrolled the badges sideways and left the table standing still. Found by reading gpui's source rather than its docs, which CLAUDE.md already warns are unreliable here.

The badges and their container are flex_none. An overflow container's children still take part in flex layout, so without it they compress to fit the strip rather than overflow it — and there is nothing left to scroll.

The strip is keyed by commit id, not row index. gpui stores the scroll offset per element id, and a row index is a position in a virtualised list: it belongs to a different commit as soon as the history is filtered or reloaded, which would carry one commit's scroll position onto another's badges.

Testing

cargo clippy --all-targets -- -D warnings and cargo fmt --all --check pass. No test: this is layout, and the delegate's existing tests cover row selection rather than element structure.

Not confirmed in the running app. gitr is single-instance and the installed binary held the socket, so I never got this build in front of a human eye. Worth a look at a row with many refs, and at whether a horizontal gesture over a strip also drags the table's own horizontal scroll — both elements are in the hit-test chain and would each apply the delta.

A commit carrying more references than the subject column is wide lost the last
of them: the cell is one `h_flex` with `overflow_hidden`, so the badges past the
edge were simply not drawn, and the subject with them. On this repository's tip,
six refs left no subject visible at all.

The badges now sit in a strip of their own that scrolls horizontally, capped at
half the cell so the subject always keeps its share. Nothing is added to draw a
scrollbar: the strip scrolls under the trackpad and shows no chrome.

`restrict_scroll_to_axis` is the part that is not optional, and not what the
name suggests. It defaults to false (`gpui::style`), and with it unset a
scrollable-x element treats a *vertical* delta as horizontal whenever its own y
overflow is not `Scroll` — so a vertical gesture anywhere over a badge strip
would have scrolled the badges sideways and left the table standing still. It is
set explicitly here.

The badges and their container are `flex_none`: an overflow container's children
still take part in flex layout, so without it they would compress to fit the
strip rather than overflow it, and there would be nothing to scroll.

The strip is keyed by commit id rather than by row index. gpui stores the scroll
offset per element id, and a row index is a position in a virtualised list — it
belongs to a different commit as soon as the history is filtered or reloaded,
which would carry one commit's scroll position onto another's badges.
@LeadcodeDev LeadcodeDev self-assigned this Aug 29, 2026
@LeadcodeDev LeadcodeDev added the enhancement New feature or request label Aug 29, 2026
@LeadcodeDev
LeadcodeDev merged commit 4e92324 into main Aug 29, 2026
3 checks passed
@LeadcodeDev
LeadcodeDev deleted the feat/scrollable-reference-badges branch August 29, 2026 10:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant