Skip to content

fix: draw Powerline separators as vector geometry and clamp oversized glyphs#185

Open
cunninghamcard-bit wants to merge 1 commit into
coder:mainfrom
cunninghamcard-bit:fix/powerline-vector-glyphs
Open

fix: draw Powerline separators as vector geometry and clamp oversized glyphs#185
cunninghamcard-bit wants to merge 1 commit into
coder:mainfrom
cunninghamcard-bit:fix/powerline-vector-glyphs

Conversation

@cunninghamcard-bit

Copy link
Copy Markdown

Fixes #184.

What

Two changes in CanvasRenderer.renderCellText:

  1. Powerline separators (U+E0B0-U+E0B7) are drawn as exact vector geometry (solid triangles, angle outlines, half-circles) covering the cell box, instead of font glyphs. Font rasterization leaves AA fringe on the diagonals and sub-cell ink height (background bleeds through above/below), which reads as smudged, banded segment edges in Powerline prompts. WezTerm and xterm.js (customGlyphs) special-case these codepoints the same way. Shapes use the already-set fillStyle, so colors follow the cell foreground exactly like a glyph would; even codepoints are solid variants, odd ones the thin outline variants (1px stroke).

  2. fillText now passes the cell's allocated width as maxWidth. Fallback-font glyphs (Nerd icons, emoji) often advance wider than the primary-font cell (Symbols Nerd Font Mono icons: 1em = 1.67 cells at 13px); unclamped ink bleeds into neighbor cells where partial repaints (cursor row) shave it into ragged artifacts, since rows repaint by background fill without clearRect. maxWidth compresses the advance to fit — same result as a Mono-patched font, with no per-glyph measureText cost.

Testing

  • bun run fmt && bun run lint && bun run typecheck clean.
  • bun test: no regressions vs a clean checkout in my environment (the same 302 pre-existing failures that need WASM build artifacts); adds 2 passing tests for the new exported isPowerlineSeparator range helper.
  • Verified pixel-level in an Electron embedder on a 2x display against WezTerm rendering the same starship prompt (fading-arrow theme, rounded caps, Nerd icons): segment edges and separators now match crisp; previously smudged/banded.

🤖 Generated with Claude Code

… glyphs

Two rendering fixes for prompt "smudge" artifacts in the canvas renderer:

1. Powerline separators (U+E0B0-U+E0B7) are now drawn as exact vector
   paths filling the cell box instead of font glyphs. Font rasterization
   leaves anti-aliasing fringe on the diagonals and sub-cell ink height,
   so the background bleeds through above/below the glyph — with
   powerline-heavy prompts (starship segments) this reads as smudged,
   banded segment edges. WezTerm and xterm.js (customGlyphs) special-case
   these codepoints for the same reason.

2. fillText now passes the cell's allocated width as maxWidth. Glyphs
   served by fallback fonts (Nerd icons, emoji, symbols) often carry an
   advance wider than the cell measured from the primary font; unclamped
   ink bleeds into neighbor cells, where later partial repaints (cursor
   row) shave it into ragged artifacts since rows repaint by background
   fill without clearRect. maxWidth compresses the advance to fit, the
   way a Mono-patched font would.

Verified pixel-level against WezTerm rendering the same starship prompt
(fading-arrow theme, rounded caps, Nerd icons) on a 2x display.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.

Powerline prompts render as smudged/banded segments: font-rasterized separators + unclamped fallback glyphs

2 participants