Repository navigation
[CTX-1919] fix(runtime): stop the bottom band pooling the remainder under its glyphs - #3285
Conversation
…nder its glyphs bitty#3282: the innermost bottom band absorbs the sub-cell remainder into its granted rect (bitty#3263), and paint used that full granted height for the per-run fills, the glyph origin and the shared chrome rule, so the absorbed remainder landed as dead band fill below the glyphs. Paint, hit-testing and tooltip anchoring now read the band's painted cell row (BandPixelGeometry::cell_row): exactly one cell row, bottom-aligned inside the granted rect, with the absorbed remainder left as window background above it. Every other edge, an exact-multiple surface and a band without slack keep the granted rect; the bottom-anchored overlay stack follows the same slack (content_drop) so its card still ends on the band's painted edge. band_bottom_inset.rs now pins the painted extent, hit-test agreement and the glyph row itself (first/last foreground ink offsets against an exact-multiple control); a present regression pins the anchored card ending on the painted cell row.
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Xuepoo
left a comment
There was a problem hiding this comment.
Independent review of PR #3285 (CTX-1919, issue #3282 — bottom band pools the sub-cell remainder under its glyphs). Reviewed head: 17e5ada, re-read via the API after the last check; the head did not move during this review. Worked read-only on the lane worktree; all mutation evidence below is from a scratch clone.
1. Full-diff read — PASS. c8584db..17e5ada touches exactly the four claimed files (band_geometry.rs +54, band_host.rs +5/-1, present.rs +91, tests/band_bottom_inset.rs +164; 291+/23-); no unrelated files, and layout_focus.rs / pane-grid centering (issue #3284) are not touched. The fix implements the criteria: BandPixelGeometry::cell_row bottom-aligns exactly one cell row inside the granted rect and leaves the absorbed remainder above it as window background (crates/bitty-runtime/src/runtime/band_geometry.rs:208-231); the per-run fill, the glyph origin (rect.x, rect.y) and the chrome rule all paint that cell row (crates/bitty-runtime/src/runtime/present.rs:6685-6697, 6724-6738); the hit-test reads the same cell row (crates/bitty-runtime/src/runtime/band_host.rs:2440); the tooltip anchor shifts by content_drop and the card clips at the painted cell row (present.rs:6986-6991, 7023-7025).
2. Hit-test parity — PASS. plugin_band_cell_hit resolves a row band through geometry.cell_row(...) (band_host.rs:2440) — the identical call paint_band_row uses for its fill and glyph origin (present.rs:6685) — so every painted row answers its own band. BandPixels::contains is half-open (band_geometry.rs:94-100), so one pixel above or below the painted row is not band chrome. The tests pin it: assert_hit_matches_paint probes every painted row for its own edge and asserts first-1 and last+1 both miss (crates/bitty-runtime/tests/band_bottom_inset.rs:274-298), exercised at :441, :525 and :636.
3. Stacked bands + tooltip anchor — PASS. Exact multiples keep the granted rect (cell_row returns it unchanged when granted.height <= cell_h, band_geometry.rs:220-222; content_drop is 0 there). Top bands keep the granted rect (edge != Bottom early return, band_geometry.rs:216-218); column bands are untouched — the hit path still uses area_band (band_host.rs:2441) and column paint was not modified. Stacked tiling: only the innermost band absorbs the remainder, at its top (band_geometry.rs:366-379), so each band paints its own one-cell row and the painted stack tiles [inset - n*cell_h, inset) with no seam — pinned at tests/band_bottom_inset.rs:502-525 (two contiguous cell rows, absorbed remainder as background above). The anchored overlay follows the painted row: y_offset gains content_drop (present.rs:6986-6991) and the card clips at cell_row(...).y (present.rs:7023-7025), pinned by bottom_band_tooltip_ends_on_the_painted_cell_row (present.rs:10570).
4. Mutation discrimination — PASS (scratch clone, own CARGO_TARGET_DIR). Clone at 17e5ada, only the three production files (band_geometry.rs, band_host.rs, present.rs) reverted to c8584db, regression tests kept. Exactly the three claimed tests go red:
bottom_band_glyphs_sit_in_the_painted_cell_row— band_bottom_inset.rs:839 "glyph origin: the ink starts at the painted cell row's own top, not the granted rect's" left: 1, right: 8 (the claimed red line, reproduced verbatim);band_bottom_is_the_physical_inset_on_a_remainder_surface— :411 "the painted band starts one cell above the inset" left: Some(369), right: Some(376);stacked_bottom_bands_tile_the_zone_with_no_seam— :503 "the painted stack starts two cells above the inset" left: Some(350), right: Some(357).
The other five tests (exact-multiple control, top band, container/grid guard, fractional DPI, PTY winsize) stay green on the reverted tree — controls green on both trees, as claimed. With the fix restored the full file is 8/8 green and the tree is identical to the PR head (emptygit diff 17e5ada4).
5. Independent gates on the PR head — PASS. cargo clippy -p bitty-runtime --all-targets --offline -- -D warnings exit 0; cargo test -p bitty-runtime --offline --test band_bottom_inset 8 passed / 0 failed; cargo +1.85 check -p bitty-runtime --tests --offline exit 0. The new present.rs regression also passes on the head (cargo test --lib bottom_band_tooltip_ends_on_the_painted_cell_row — 1 passed).
6. MSRV/lint defect scan — PASS. The new code has no let-chains, no if-let match guards, no new consts, no #[allow] papering over warnings; all comments are English; no hardcoded host paths, usernames or ports (grep over the full diff is clean). cell_row/content_drop use plain guards and saturating conversions (band_geometry.rs:216-248).
7. Test-quality scan — PASS. No sizing tautology: the glyph regression compares the remainder fixture's ink offsets against a separately constructed exact-multiple control runtime (band_bottom_inset.rs:815), not against its own inputs; the tooltip test asserts its fixture precondition first (present.rs:10609, 10614) and then pins the card's bottom edge to the painted row (present.rs:10633). ink_rows_over_fill (band_bottom_inset.rs:251-261) has a real one-pixel failure mode: it returns exact row indices, so a one-row drift moves the first/last ink row and flips the offset assertions — demonstrated by the 7 px drift failing as left: 1, right: 8. Every named test fails on the pre-fix tree (check 4), so none is unfailable.
8. PR hygiene — PASS. Exactly one closing directive ("Closes #3282", body); title carries the literal "[CTX-1919]" prefix; labels fix / P2 / area:runtime; milestone v0.1.0.
9. CI snapshot (record only). At review time: 8 pass, 8 pending, 3 skipping (CodeQL / VM tier main / VM tier nightly ARM64). Pending legs were not waited on and do not affect this verdict.
10. Reviewed head. 17e5ada — quoted at the top and re-read from the API after the final check; unchanged, so this review is not stale.
Residual non-blocking observations (not part of the verdict):
- A row band's hit rect still spans the full granted width (the unclaimed trailing region past the painted text hits). This is pre-existing, documented behavior (band_host.rs:2378-2384) and unchanged by this PR; the parity criterion concerns rows.
- The
BandPixelsdoc line "paint emits a fill at exactly this rect (so the rect is the band's damage)" (band_geometry.rs:72-74) predates the granted-rect vs painted-cell-row split;cell_row's own docs describe the split correctly, but that older line could use a touch-up in a follow-up. content_dropre-derives theheight - cell_hslack thatcell_rowalso computes; a future refactor could share the arithmetic. No action needed.
VERDICT: APPROVE
Closes #3282
Root cause
bitty#3263 anchored the bottom band stack to the window's physical bottom
inset and let the innermost band absorb the sub-cell remainder at its top, so
its granted rect is
cell_h + remaindertall.paint_band_rowused thatfull granted height for both the per-run
FillRectand the glyph origin, sothe cell row was pinned to the rect's top and the absorbed remainder landed
as pure band fill BELOW the glyphs — measured on 0.0.46: band rect 39 px =
cell 30 + remainder 9, capsule fill 38 rows, glyph ink pinned at the rect
top. Not fixable in the plugin:
BandContentcarries no height and everyrun shares the band rect.
Fix
Paint, hit-testing and tooltip anchoring now read the band's painted cell
row (
BandPixelGeometry::cell_row): exactly one cell row, bottom-alignedinside the granted rect, with the absorbed remainder left as window
background above it.
paint_band_rowuses it for the per-run fills, the glyph origin and theshared chrome rule.
plugin_band_cell_hithit-tests the same cell row, so paint andinteraction stay one mapping: a painted row answers its own band, and one
pixel outside the painted row is not band chrome.
(
content_drop) and its card clips at the painted cell row, so anchoredrows still end on the band's painted edge.
keep the granted rect unchanged.
Regression
bottom_band_glyphs_sit_in_the_painted_cell_rowpins the glyph row itself:the first and last foreground ink rows inside the painted cell row equal an
exact-multiple control's ink offsets (glyph pixels are alpha-blended, so
the observable is a pixel over the band's own fill that differs from it).
The remainder fixtures in
band_bottom_inset.rsnow pin the painted bandbeing exactly one cell row bottom-aligned on the inset with the absorbed
remainder as window background, plus paint/hit agreement; a present
regression pins the anchored card ending on the painted cell row.
Discrimination proof
Pre-fix production sources at c8584db, regression tests kept:
band_bottom_is_the_physical_inset_on_a_remainder_surfaceandstacked_bottom_bands_tile_the_zone_with_no_seamalso fail; theexact-multiple control and the container/winsize guards stay green on both
trees.
Local gates
cargo fmt --check -p bitty-runtime— passcargo clippy -p bitty-runtime --all-targets --offline -- -D warnings— passcargo test -p bitty-runtime --offline -- band— pass (251 test binaries, 0 failed)cargo test -p bitty-runtime --offline --test band_bottom_inset— pass (8/8)cargo test -p bitty-runtime --offline --lib— pass (1720/1720)cargo +1.85 check -p bitty-runtime --tests --offline(MSRV) — passUX reference
One-row status chrome follows the ghostty/kitty-class convention: a one-row
bar occupies exactly one cell row and stays flush with the window's bottom
inset; sub-cell slack is window background, never extra bar padding.
Deviation: none — the fix restores exactly that. The remainder above the
innermost band stays background rather than being distributed, which keeps
the inset anchor from bitty#3263 intact.
Out of scope: the pane grid's own bottom-heavy centering (bitty#3284) is a
separate lane and is not touched here.
Summary by CodeRabbit