Skip to main content

Synchronous Rendering

MonoTerm uses synchronous rendering to eliminate the 1-frame flicker that occurs with xterm.js’s default async rendering path.

The Problem: RenderDebouncer Delay

xterm.js uses a RenderDebouncer that schedules all rendering for the next requestAnimationFrame. This creates a 1-frame delay between buffer update and screen display.

The Solution: Direct _renderRows() Call

MonoTerm bypasses the RenderDebouncer by calling _renderRows() directly, achieving immediate rendering.

Code-Level Difference

Async Path (xterm.js Public API)

Sync Path (MonoTerm Direct Call)

Why This Matters for AI CLI

AI tools produce rapid output streams. With async rendering, every update creates a visible delay.

Implementation Sites

MonoTerm applies synchronous rendering at 15 critical points across 5 files:

Why Debouncer Exists (And Why We Bypass It)

The RenderDebouncer serves a purpose in traditional terminals:

Comparison Summary

Diff Rendering

How AtomicState calculates minimal updates

ACK Flow Control

Backend rate limiting that enables sync render

BSU/ESU Protocol

Atomic frame batching from PTY

Atomic Loop

The complete rendering cycle