fix(widgets): keep the section border under a panel scrollbar - #2974
Open
sinelaw wants to merge 1 commit into
Open
fix(widgets): keep the section border under a panel scrollbar#2974sinelaw wants to merge 1 commit into
sinelaw wants to merge 1 commit into
Conversation
A widget panel's scroll region is deliberately widened by two columns so it reaches through the right padding and onto the wrapping `LabeledSection`'s `│` border — the bar hugs the box edge instead of floating a column inboard, and a wheel over the border still scrolls the list. But the bar is painted as a blank cell per row, which is right over a list's own padding and wrong over a border: it rubbed the box's right edge out on every row it covered. The code tour's explanation box is where this shows: as soon as its prose is taller than the rows it has — any short dock, which includes a tour opened into an already-open bottom dock — the box renders with a top and a bottom border and no right edge at all in between. At width 140 it is correct at heights 45/44/42 and broken at 40 and below, purely because the shorter dock is what makes the prose overflow. Width has nothing to do with it. Paint those two bars (split-mounted panels and floating ones) through a scrollbar renderer that keeps the glyph already in the column and re-styles only its background. The border stays closed, the bar still reads as a bar, and over an ordinary list row — a space — it paints exactly as before. Fixes sub-issue 3b of #2969. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013LV5WvsL3drUfQmFRMe4kP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes sub-issue 3b of #2969 — "Tour explanation box loses its right border at short dock heights".
What was wrong
collect_labeled_sectionwidens a child's scroll region by two columns on purpose, so the bar lands on the section's│border rather than floating a column inboard (and so a wheel over the border still scrolls the list).render_scrollbarthen paints one blank cell per row — correct over a list's own padding, destructive over a border. Every row the bar covered lost the box's right edge.That is the whole of 3b: the border is not "missing", it is overwritten by a space. Reading the same frame with colours shows it — the last column of each content row is a space carrying the scrollbar's thumb/track background:
Which explains the height threshold in the issue (140x45/44/42 fine, 40 and below broken) and why width is irrelevant: a shorter dock is simply what makes the prose overflow its window and earn a scrollbar. Same for "opening the tour into an already-open bottom dock renders borderless immediately" — that dock is shorter from the start.
The fix
render_scrollbar_over_chromepaints the same track/thumb colours but keeps whatever glyph is already in the column, re-styling only its background. Used at the two widget-panel paint sites (split-mounted panels, floating panels), which are exactly the bars whose regions were extended onto the section border. Every other scrollbar in the editor — file browser, settings, keybinding editor, prompt suggestions, buffer scrollbars — is untouched.The box stays closed, the bar still reads as a bar (border glyph in thumb/track colours), and over an ordinary list row — a space — it paints identically to before, so
is_scrollbar_thumb_at/is_scrollbar_track_atand the existing drag/hit-test behaviour are unaffected.Verified by hand under tmux at 140x36: content rows are back to 137 columns ending in
│, with the scrollbar's background still on that column.Test
test_overflowing_lists_keep_the_section_borderincrates/fresh-editor/tests/e2e/code_tour_dock.rsloads the existing overflow-tour fixture (both the Steps rail and the prose overflow), then asserts on rendered output only: on each of the two╮columns, the bar is present (a thumb or track cell — this must not pass by having no scrollbar at all) and every content row between the top and bottom borders still carries│.Without the fix:
left: Some(" "), right: Some("│")at the first content row. With it, it passes.Checks
cargo fmt,cargo clippy,cargo check --all-targetscode_tour(34),dock(145),orchestrator(145),scrollbar(82) — all pass. The rest is left to CI.🤖 Generated with Claude Code
https://claude.ai/code/session_013LV5WvsL3drUfQmFRMe4kP
Generated by Claude Code