Renderer Correctness Plan

Renderer correctness hardening (xterm harness → wide-char correctness → synchronized output)

Status: implemented on main (March 2026).

This page keeps the original hardening plan plus what shipped.

Goals (completed)

  1. Add a terminal-accurate correctness harness (xterm-headless replay tests).
  2. Fix wide character handling end-to-end (layout measure + raster + diff emission).
  3. Add DEC 2026 synchronized output wrapping to reduce visual tearing.

Phase 1 — xterm replay harness ✅

Delivered:

  • xterm-backed replay tests in packages/react/__test__/renderer-xterm-roundtrip.spec.ts
  • deterministic round-trip tests for incremental diff replay
  • randomized ASCII smoke coverage

Outcome:

  • Renderer diffs are now validated against a real terminal model, not just string snapshots.

Phase 2 — wide-char correctness ✅

Delivered:

  • width-aware measurement in packages/react/src/layout.ts via packages/react/src/text-width.ts
  • width-aware rasterization in packages/react/src/renderer.ts
    • wide glyph cursor advancement by display width
    • explicit continuation-cell marker (0x110000 sentinel)
  • width-aware diff cursor progression in packages/core/src/lib.rs
  • targeted tests for CJK/emoji continuation behavior and replay correctness

Outcome:

  • CJK and emoji rendering/diff behavior is significantly more stable and deterministic.

Phase 3 — DEC 2026 synchronized output ✅

Delivered:

  • frame writes wrapped in \x1b[?2026h / \x1b[?2026l in:
    • packages/core/src/app.ts
    • packages/core/src/inline.ts
  • tests asserting synchronized output wrappers in frame paths

Outcome:

  • reduced visible tearing/flicker on terminals that support synchronized updates.

Current verification checklist

  • npm run build
  • npm test
  • focused renderer and replay tests
  • cargo test

Remaining gaps (intentional)

  • Full grapheme-cluster layout/render handling for complex ZWJ emoji sequences
  • Broader fuzz/property coverage across mixed Unicode categories
  • Additional terminal-emulator matrix validation beyond xterm-headless
Support

Contribute to our work and keep us going

Community is the heart of open source. The success of our packages wouldn't be possible without the incredible contributions of users, testers, and developers who collaborate with us every day.Want to get involved? Here are some tips on how you can make a meaningful impact on our open source projects.

Ready to help us out?

Be sure to check out the package's contribution guidelines first. They'll walk you through the process on how to properly submit an issue or pull request to our repositories.

Submit a pull request

Found something to improve? Fork the repo, make your changes, and open a PR. We review every contribution and provide feedback to help you get merged.

Good first issues

Simple issues suited for people new to open source development, and often a good place to start working on a package.
View good first issues