Commit c10b5b6
committed
fix(cli): wrap-aware warnings reservation + load-bearing regression test (#4386 self-review)
Two related self-review findings from my pre-push review on PR #4386:
1. SR-1: the round-1 layout regression test
(`keeps options visible alongside the warning on a tight compactMode
layout`) used a single-line command at `contentWidth=80`. `MaxSizedBox`
clamps to `min(content_lines, maxHeight)`, so a 1-line command
renders as 1 line regardless of whether `bodyContentHeight -=
warningsHeight` is applied — the test would still pass if that line
were silently removed. Replaced with a 4-line command and an
assertion on the `... N lines hidden ...` truncation footer that
MaxSizedBox emits *only* when its cap is actually active. Confirmed
RED → fix → GREEN: the new test fails when the warnings
subtraction is removed and passes when restored.
2. SR-2: the warnings-height reservation reserved `warningsCount + 1`
lines (one per warning + one marginTop separator). On narrow
terminals the warning text wraps across multiple visual rows, so
the reservation under-counts. Replace the per-warning `+1` with
`ceil((warning.length + 2) / max(contentWidth, 1))` to account for
each warning's actual rendered row count. The `+ 2` accounts for
the `⚠ ` prefix; the `max(...,1)` keeps the math defined for
pathological inputs. Independently flagged by Codex during
self-review as `[P3] Account for wrapped warning lines`.1 parent 7bb4205 commit c10b5b6
2 files changed
Lines changed: 52 additions & 13 deletions
File tree
- packages/cli/src/ui/components/messages
Lines changed: 33 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
128 | 147 | | |
129 | 148 | | |
130 | 149 | | |
131 | | - | |
132 | | - | |
| 150 | + | |
| 151 | + | |
133 | 152 | | |
134 | 153 | | |
135 | 154 | | |
| |||
147 | 166 | | |
148 | 167 | | |
149 | 168 | | |
150 | | - | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
151 | 175 | | |
152 | | - | |
153 | 176 | | |
154 | 177 | | |
155 | 178 | | |
| |||
Lines changed: 19 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
256 | 256 | | |
257 | 257 | | |
258 | 258 | | |
259 | | - | |
260 | | - | |
261 | | - | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
262 | 278 | | |
263 | 279 | | |
264 | 280 | | |
| |||
0 commit comments