fix: border side getters now account for implicit borders#609
Open
veeceey wants to merge 1 commit intocharmbracelet:masterfrom
Open
fix: border side getters now account for implicit borders#609veeceey wants to merge 1 commit intocharmbracelet:masterfrom
veeceey wants to merge 1 commit intocharmbracelet:masterfrom
Conversation
When a border style is set via BorderStyle() without explicitly enabling/disabling individual sides, the renderer treats all sides as enabled. However, the boolean getters (GetBorderTop, GetBorderRight, GetBorderBottom, GetBorderLeft, GetBorder) incorrectly returned false, creating an inconsistency between what is rendered and what the getters report. This also caused GetHorizontalFrameSize/GetVerticalFrameSize to return values that didn't match the border side getters (the size methods already handled implicit borders correctly via implicitBorders()). The fix makes the boolean border getters fall through to implicitBorders() — the same mechanism already used by the size getters and the renderer — so all three are now consistent. Fixes charmbracelet#522 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Author
|
Friendly ping - any chance someone could take a look at this when they get a chance? Happy to make any changes if needed. |
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.
Summary
GetBorderTop(),GetBorderRight(),GetBorderBottom(),GetBorderLeft(), andGetBorder()returnedfalsewhen a border style was set viaBorderStyle()without explicitly enabling sides, even though the renderer treats all sides as enabled in this case.implicitBorders()— the same mechanism already used by the size getters (GetBorderTopSize, etc.) and the renderer (applyBorder) — making all three consistent.BorderStyle()and explicit side setters.Fixes #522
Reproduction (before fix)
After this fix,
GetBorderLeft()correctly returnstrue.Test plan
TestStyleUnsetwhich was testing for the inconsistent behavior)TestGetBorderSidesWithImplicitBorderscovers five scenarios:BorderStyle()only (implicit borders) — all getters return trueBorder()with explicit sides — only enabled sides return trueBorderStyle()+ paddingBorderStyle()then explicit side setter disables implicit for other sidesgo test ./...passes all packages (lipgloss, list, table, tree)