Conversation
`paintBorder` opened with `width < 2 || height < 2`, which is right for a full border, since one row cannot hold both a top and a bottom, but wrong for a single-side one. A left-only border is a single vertical bar and is drawable at any height, so a Box whose content is exactly one row tall silently lost it. Reproduction: two columns side by side, the right one with `borderLeft`. With one line of content no border appears; with two it does. 1 Text, 1 line |left one| 1 Text, 2 lines |left │one| The guard is narrowed rather than removed: two cells are required only on an axis that draws BOTH of its sides, so a box one column wide still refuses a left-and-right border. The rest of the function already handles height 1, as the corner branch writes the single glyph and the edge loop does not run. Three regression tests in component-boundary-layout.test.ts cover the one-row case, the two-row case, and the narrowed guard still refusing what cannot fit.
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.
What you expected
A
BoxwithborderLeftdraws its border regardless of how tall the box is. A left-only border is a single vertical bar, so height 1 is perfectly drawable.What happened
The border is silently dropped when the box's content is exactly one row tall. Two rows of content, and it appears.
Minimal reproduction
Cause
paintBorderinsrc/reconciler/renderer.tsopens with:The 2x2 minimum is correct for a full border, since one row cannot hold both a top and a bottom edge plus content. It is not correct for a single-side border.
The change
The guard is narrowed rather than removed. Two cells are needed only on an axis that draws both of its sides:
A box one column wide still refuses a left-and-right border, which the third test covers.
The rest of
paintBorderalready handles height 1 correctly: the corner branch writes the single│, and thefor (let i = 1; i < height - 1; i++)edge loop does not run.Testing
Three regression tests in
src/__tests__/component-boundary-layout.test.ts(the one-row case, the two-row case, and the narrowed guard still refusing what cannot fit).npx tsc --noEmit— 0 errorsnpx vitest run— 547 passed, across three consecutive runsContext
Found while evaluating Storm as a renderer for a terminal UI with side-by-side panes, where a column's divider is a left-only border. A one-row column loses its divider, which reads as a rendering fault rather than a layout choice. Thanks for the library, the cell diffing is a genuinely different asymptote from a full repaint.