Skip to content

fix(geometry): compare terminal height in a single box model - #232

Merged
LeadcodeDev merged 1 commit into
chantier/audit-2026-09from
fix/geometry-autoscroll-box
Sep 22, 2026
Merged

LeadcodeDev merged 1 commit into
chantier/audit-2026-09from
fix/geometry-autoscroll-box

Conversation

@LeadcodeDev

Copy link
Copy Markdown
Owner

Severity Low, category correctness. Location: crates/rustmotion/src/cli/commands/geometry.rs:963

Impact

bbox.h is layout.height, the border box. LegacyPaintDispatcher::dispatch treats only Component::Codeblock(_) as self-padding (let is_self_padding = matches!(child.component, Component::Codeblock(_));); every other painter, terminal included, receives a BoxLayout whose height is layout.content_box()'s ch. So a terminal with auto_scroll: false and style.padding: "32px" has 64px less drawable height than the check credits it with: content needing 500px in a 520px border box (456px content box) overflows by 44px and is reported clean. The codeblock arm just above is correct, because codeblock really is handed the border box — so the two arms of the same violation kind need different boxes and currently use the same one.

Fix

Pass the BoxLayout (not a BBox) into check_auto_scroll and compare the terminal's natural height against layout.content_box().3, keeping layout.height for the codeblock arm; add a comment naming is_self_padding as the reason the two differ.

Evidence the audit read

Component::Terminal(t) if !t.auto_scroll => {
    let (_, natural_h) =
        TerminalIntrinsic::from_terminal(t).measure((None, None), max_content);
    if natural_h > bbox.h + 0.5 {

Stacked on fix/geometry-nowrap-height, which carries the previous finding of this workstream. GitHub shows only this finding's diff; merge in order.

Part of the September 2026 audit remediation chantier. Refs #220 (RM-33).

@LeadcodeDev LeadcodeDev added the bug Something isn't working label Sep 21, 2026
@LeadcodeDev LeadcodeDev self-assigned this Sep 21, 2026
@LeadcodeDev
LeadcodeDev force-pushed the fix/geometry-nowrap-height branch from 9467962 to da572b3 Compare September 21, 2026 23:39
@LeadcodeDev
LeadcodeDev force-pushed the fix/geometry-autoscroll-box branch from 2e3c60c to 6bc338b Compare September 21, 2026 23:39
@LeadcodeDev
LeadcodeDev force-pushed the fix/geometry-nowrap-height branch from 7be118b to 3bc56f9 Compare September 22, 2026 06:09
@LeadcodeDev
LeadcodeDev force-pushed the fix/geometry-autoscroll-box branch from e689845 to d9e3be1 Compare September 22, 2026 06:09
@LeadcodeDev
LeadcodeDev force-pushed the fix/geometry-nowrap-height branch from 3bc56f9 to c5036fe Compare September 22, 2026 08:34
@LeadcodeDev
LeadcodeDev force-pushed the fix/geometry-autoscroll-box branch from d9e3be1 to 9af265d Compare September 22, 2026 08:34
@LeadcodeDev
LeadcodeDev force-pushed the fix/geometry-nowrap-height branch from c5036fe to 5521bc8 Compare September 22, 2026 08:43
@LeadcodeDev
LeadcodeDev force-pushed the fix/geometry-autoscroll-box branch from 9af265d to 2793eea Compare September 22, 2026 08:43
@LeadcodeDev
LeadcodeDev changed the base branch from fix/geometry-nowrap-height to chantier/audit-2026-09 September 22, 2026 08:52
`bbox.h` is `layout.height`, the border box. `LegacyPaintDispatcher::dispatch` treats only `Component::Codeblock(_)` as self-padding (`let is_self_padding = matches!(child.component, Component::Codeblock(_));`); every other painter, terminal included, receives a `BoxLayout` whose height is `layout.content_box()`'s `ch`. So a `terminal` with `auto_scroll: false` and `style.padding: "32px"` has 64px less drawable height than the check credits it with: content needing 500px in a 520px border box (456px content box) overflows by 44px and is reported clean. The codeblock arm just above is correct, because codeblock really is handed the border box — so the two arms of the same violation kind need different boxes and currently use the same one.

Refs #220
@LeadcodeDev
LeadcodeDev force-pushed the fix/geometry-autoscroll-box branch from 2793eea to fa41779 Compare September 22, 2026 08:59
@LeadcodeDev
LeadcodeDev merged commit c16ec55 into chantier/audit-2026-09 Sep 22, 2026
LeadcodeDev added a commit that referenced this pull request Sep 22, 2026
`bbox.h` is `layout.height`, the border box. `LegacyPaintDispatcher::dispatch` treats only `Component::Codeblock(_)` as self-padding (`let is_self_padding = matches!(child.component, Component::Codeblock(_));`); every other painter, terminal included, receives a `BoxLayout` whose height is `layout.content_box()`'s `ch`. So a `terminal` with `auto_scroll: false` and `style.padding: "32px"` has 64px less drawable height than the check credits it with: content needing 500px in a 520px border box (456px content box) overflows by 44px and is reported clean. The codeblock arm just above is correct, because codeblock really is handed the border box — so the two arms of the same violation kind need different boxes and currently use the same one.

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

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant