Skip to content

feat: snap SVG dimensions to terminal character grid#7

Open
xav-ie wants to merge 1 commit intoagentstation:mainfrom
xav-ie:feat/svg-dimension-snapping
Open

feat: snap SVG dimensions to terminal character grid#7
xav-ie wants to merge 1 commit intoagentstation:mainfrom
xav-ie:feat/svg-dimension-snapping

Conversation

@xav-ie
Copy link

@xav-ie xav-ie commented Feb 26, 2026

Summary

  • Snap the inner SVG viewport dimensions to cols × charWidth and rows × charHeight using math.Round to eliminate sub-pixel gaps between terminal content and the SVG edge
  • Recalculate outer dimensions (including padding/bar) to match the snapped inner area

Context

The SVG viewport was previously sized from the style config, which doesn't always align to the character grid. This left fractional-pixel gaps at content edges. Snapping to the grid and rounding to the nearest integer minimizes these gaps.

Test plan

  • Existing tests pass (go test ./...)
  • Independent of other PRs — cherry-picks cleanly onto main

Use TermCols/TermRows from xterm.js to snap the inner SVG viewport
to the exact character grid, eliminating black bars and subpixel gaps.
Set background color on the outer <svg> element to prevent edge
rendering artifacts.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant