fix(core): clip transparent box borders to scissor - #1352
Open
rohit-jsfreaky wants to merge 1 commit into
Open
Conversation
rohit-jsfreaky
requested review from
Hona,
kommander,
msmps and
simonklee
as code owners
August 8, 2026 19:21
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.
Fixes #1311
Problem
A bordered box that is only partially visible inside a scrollbox can overlap the active scissor rectangle. Most drawing paths are clipped through
validateAndIndex, but the transparent border fast path writes directly to the backing character, foreground, and attribute buffers. Those direct writes bypass the scissor check, allowing border cells to overwrite neighboring UI outside the scrollbox viewport.Change
Check the active scissor rectangle for every top, bottom, left, and right border cell before entering the rendering path. This makes the transparent fast path follow the same clipping contract as opaque and blended border rendering, while retaining the fast path for visible cells.
Regression Coverage
Adds a native buffer regression using a transparent box background so the direct-write path is exercised. It clips the box horizontally and verifies that clipped border cells preserve the existing content while visible border segments still render. Before this change, the test fails because a clipped corner is written as
0x250cinstead of the original space.Validation
zig build test -Dtest-filter="OptimizedBuffer - drawBox respects scissor clipping"zig build test(1,860passed,22skipped)bun run fmt:checkbun run lint:ci