Skip to content

feat: snap SVG dimensions to terminal character grid - #7

Closed
xav-ie wants to merge 1 commit into
agentstation:mainfrom
xav-ie:feat/svg-dimension-snapping
Closed

xav-ie wants to merge 1 commit into
agentstation:mainfrom
xav-ie:feat/svg-dimension-snapping

Conversation

@xav-ie

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

Copy link
Copy Markdown

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.
@jackspirou

Copy link
Copy Markdown
Member

The repaired proposal is in PR 12. It retains your original commit and merges current main without rewriting history.

The repair preserves rounded corner transparency and caller style settings. It adds grid, fractional metric, margin, native capture, and browser pixel tests. All 239 native race cases, static checks, builds, and 106 tape checks pass. Pre-PR review passes.

The contributor-fork write check failed at Git LFS authentication, so the repaired branch is in AgentStation. I will resolve this PR after the replacement passes CI and merges.

@jackspirou

Copy link
Copy Markdown
Member

The repaired proposal merged in PR 12, commit 27743a13. The original contribution remains in main history. All eight hosted build and lint checks passed.

The merged repair fits measured terminal cells, preserves rounded corner transparency and margin fill, and leaves caller capture settings unchanged. Native Chrome race verification passed all 239 cases.

@jackspirou

Copy link
Copy Markdown
Member

Thank you, @xav-ie, for identifying the fractional-cell gaps and proposing a grid-based viewport. Your original commits are retained in main through replacement #12. The repair rounds the grid bounds upward to retain every cell and preserves margins, window bars, rounded transparency, and the caller’s style. Native capture and pixel tests passed, and all eight hosted checks passed before merge. I am checking the full original benefit list as well; closing this PR is not the acceptance criterion.

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.

2 participants