Skip to content

fix(core): clip transparent box borders to scissor - #1352

Open
rohit-jsfreaky wants to merge 1 commit into
anomalyco:mainfrom
rohit-jsfreaky:fix/drawbox-scissor-clipping
Open

fix(core): clip transparent box borders to scissor#1352
rohit-jsfreaky wants to merge 1 commit into
anomalyco:mainfrom
rohit-jsfreaky:fix/drawbox-scissor-clipping

Conversation

@rohit-jsfreaky

@rohit-jsfreaky rohit-jsfreaky commented Aug 8, 2026

Copy link
Copy Markdown

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 0x250c instead of the original space.

Validation

  • zig build test -Dtest-filter="OptimizedBuffer - drawBox respects scissor clipping"
  • zig build test (1,860 passed, 22 skipped)
  • bun run fmt:check
  • bun run lint:ci

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant