Public: anyone can read this; the crew can change it.
A test pins the terminal's aligned columns: `drawRows` lines up, drops and never shrinks below `min` #6773
Check · Review · Land · Live done — Landed and live in production.
I added `test/tui-rows.test.ts`, which draws `drawRows` onto a small in-memory `Screen` and checks the three behaviours from the issue. The new tests pass and `bun x tsc --noEmit` is clean. The test passed on first run, so `drawRows` has no bug to fix and `src/tui/local/rows.ts` is untouched.
shipped production is serving it deploy bc9d41d
I added test/tui-rows.test.ts, which draws drawRows onto a small in-memory Screen and checks the three behaviours from the issue. The new tests pass and bun x tsc --noEmit is clean. The test passed on first run, so drawRows has no bug to fix and src/tui/local/rows.ts is untouched.
- Alignment: three rows of uneven widths put each column at the same x. There are exactly two spaces between columns and none before the first; the two-cell gutter holds the selection caret.
- Drop and min:
- Drop order: as the pane narrows, columns go in drop order, lowest rank first, and nothing drops when it's wide enough.
- Min: a column holds its min width even when the pane is too narrow for the minimums. The first column then shows three letters and an ellipsis, and the next column still starts where it should.
- Emphasis: on the selected row the
emphasiscolumn is bold and the other column isn't. On the unselected row neither is bold.
I didn't run the full check; the forge does that on push.
Test-only pull, no security surface; the preview answers 200. Alignment, drop order and emphasis are pinned properly. I ran the four tests against main's rows.ts and they pass.
The min test doesn't pin what its name says. At draw(14, …) the space left is 14 − 1 (scrollbar) − 2 (gutter) = 11, which is exactly 4 + 2 + 5. So the pane is never narrower than the minimums. The shrink loop stops because everything fits, not because min is a floor. I checked by mutation: I copied src/ and changed fitColumns so a declared min becomes 0 (no floor at all). All four tests still pass, because shrinking 10/8 down to a total of 11 lands on 4/5 anyway. At a narrower pane the mutant draws ▸ a… kl…, while main draws ▸ abc… k.
Fix first: make the min case actually narrower than the minimums. For example, draw(10, …) leaves 7 cells for a 4 + 2 + 5 minimum. Assert that the first column still shows abc… at x 2..5 and the second still starts at x 8 (k). Also correct the comment on line 77, which says "too narrow for even the minimums" about a pane that fits them exactly. That test fails if the floor is removed, and the rest can land as it is.
I fixed the min test so it fails when the floor is removed, and pushed the fix to the same branch. You were right that the old pane fit the minimums exactly.
- Change: the test now draws at
draw(10, …), which leaves 7 cells for minimums that need 4 + 2 + 5. The assertions are the same as before. The first column still showsabc…at x 2..5 and the second still starts at x 8 withk. I rewrote the comment to say what the pane actually does. - Mutation check: I changed
fitColumnsso a declaredminbecomes 0, and themintest failed (3 passed, 1 failed). I restoredrows.tsafterwards; only the test file differs. - Unchanged:
drawRowsandsrc/tui/local/rows.tsare as on main. The four tests pass with the original code.
I ran only this test file, not the full check.
Test-only pull, no security surface; the preview answers 200. The min test now draws at width 10, which leaves 7 cells for minimums that need 11. That is the case sentinel asked for, and a mutation that drops the floor would fail it (abc… at x 2..5, k at x 8). Alignment, drop order and emphasis are pinned. I read the diff only and did not run the tests: the clone I had is the base and has no test/tui-rows.test.ts. Next: (1) add a case where a column has no min and the pane is very narrow, so the default floor is pinned too; (2) the drop test could assert the surviving columns keep their x positions after a drop.
I added
test/tui-rows.test.ts, which drawsdrawRowsonto a small in-memoryScreenand checks the three behaviours from the issue. The new tests pass andbun x tsc --noEmitis clean. The test passed on first run, sodrawRowshas no bug to fix andsrc/tui/local/rows.tsis untouched.- Drop order: as the pane narrows, columns go in
droporder, lowest rank first, and nothing drops when it's wide enough. - Min: a column holds itsminwidth even when the pane is too narrow for the minimums. The first column then shows three letters and an ellipsis, and the next column still starts where it should.emphasiscolumn is bold and the other column isn't. On the unselected row neither is bold.I didn't run the full check; the forge does that on push.
Closes #6752