Context
2code's primary use case is hosting AI CLI tools (Claude Code, Codex, etc.). xterm.js has several limitations for this use case:
This issue tracks research into alternative terminal rendering architectures.
Architecture Comparison
Current: xterm.js
Pipeline: PTY bytes → JS VT parser (DFA) → CircularList grid → DOM/WebGL renderer
Pros: most mature web terminal, huge ecosystem, VS Code uses it
Cons: JS parsing bottleneck, no native Kitty protocol, scroll-jump bug
Rendering: DOM (default), WebGL addon, Canvas 2D (deprecated)
Option A: ghostty-web (Ghostty VT → WASM)
Pipeline: PTY bytes → WASM VT parser (Ghostty/Zig SIMD) → Canvas 2D renderer
Source: coder/ghostty-web
Pros: Kitty protocol native, no scroll-jump issue (Canvas rendering), faster VT parsing
Cons:
WASM memory corruption (#141 ) — free() after emoji causes all subsequent terminals to crash. Blocking for multi-tab apps
Maintenance stalled (v0.4.0, 2025-12-09, 5 months no release)
Korean IME broken, no image protocol, no search, no WebGL renderer
Zero Tauri integration examples
Scrollback unit bug (#140 ) + viewport corruption (#139 )
Status: NOT VIABLE currently. Monitor fix(build): handle empty array expansion under bash nounset mode #141 and perf: reuse file tree path collator #162 (Ghostty 1.3 upgrade)
Option B: alacritty_terminal (Rust backend + WebView rendering)
Pipeline: PTY bytes → Rust VT parser → Grid model + damage tracking → IPC → WebGL/Canvas in WebView
Source: alacritty_terminal crate + egui_term embedding example
Pros: battle-tested VT parser, damage tracking reduces IPC overhead, full control
Cons:
No existing WebView integration — GitHub search "alacritty_terminal webview" returns 0 results
All Tauri terminal projects use xterm.js (hermes-ide, kerminal, Terminal-64)
IPC overhead: incremental updates 1-5KB/frame OK, full redraws 46-384KB/frame problematic with JSON
Estimated 2000-4000 lines of bridge code
Need to build WebGL renderer from scratch
Status: Technically feasible but high effort, no precedent
Option C: libghostty (Zig/C library)
Pipeline: PTY bytes → libghostty (SIMD VT parser + grid + damage tracking) → C API → Rust FFI → IPC → WebView
Source: libghostty announcement , awesome-libghostty
Pros: fastest VT parser (SIMD), native Kitty protocol, growing ecosystem (browstty, obsidian-ghostty-terminal, vscode-bootty)
Cons:
Zig → C → Rust FFI chain
Still alpha, official WASM distribution not published
Same WebView rendering challenge as Option B
Status: Most promising long-term, too early now
Notable: xterm.js itself considering adopting libghostty — but no consensus among maintainers
Option D: Stay on xterm.js, upgrade to 7.0
Pipeline: Same as current, but with upstream fixes
xterm.js 7.0 milestone includes:
PR #5770 — DEC 2026 viewport fix (eliminates scroll jump)
Potentially libghostty adoption (per #5686, but no timeline)
Combine with:
Status: Most pragmatic path
Not viable
termwiz : Not a terminal emulator. Surface/Change model is for building TUI apps, cannot process bash/vim escape sequences.
Kitty rendering code : Tightly coupled to window management, no library form, no API.
Warp terminal code : WarpUI not independently published, AGPL-3.0 license.
Tauri native terminal view : Tauri 2 doesn't support embedding non-WebView native components without per-platform plugin work.
How Other Terminals Handle AI CLI Tools
Terminal
Architecture
AI CLI scroll issue?
Solution
Warp
Block model + Metal/wgpu
No
Each command is isolated block
Kitty
OpenGL + C parser
No
GPU rendering, no DOM scroll
Ghostty
Metal/GL + Zig SIMD parser
No
Same as Kitty
VS Code
xterm.js
Yes
Same issue, no fix yet
Tabby
xterm.js
Yes → Fixed
pinnedToBottom flag (PR #11102 )
Hyper
xterm.js
Yes
Unfixed since 2023 (#7065 )
iTerm2
Native Cocoa
Partial
Native rendering helps, but Ink layer still flickers
WezTerm
termwiz + wgpu
Has issues
#7531 , limited info
Recommendation
Short-term (now): Stay on xterm.js. Inject Claude Code env vars + implement Tabby-style scroll fix.
Medium-term (xterm.js 7.0): Upgrade when 7.0 releases with PR #5770 (DEC 2026 viewport fix).
Long-term (watch):
Related
Context
2code's primary use case is hosting AI CLI tools (Claude Code, Codex, etc.). xterm.js has several limitations for this use case:
This issue tracks research into alternative terminal rendering architectures.
Architecture Comparison
Current: xterm.js
Pipeline:
PTY bytes → JS VT parser (DFA) → CircularList grid → DOM/WebGL rendererOption A: ghostty-web (Ghostty VT → WASM)
Pipeline:
PTY bytes → WASM VT parser (Ghostty/Zig SIMD) → Canvas 2D rendererSource: coder/ghostty-web
free()after emoji causes all subsequent terminals to crash. Blocking for multi-tab appsOption B: alacritty_terminal (Rust backend + WebView rendering)
Pipeline:
PTY bytes → Rust VT parser → Grid model + damage tracking → IPC → WebGL/Canvas in WebViewSource: alacritty_terminal crate + egui_term embedding example
Option C: libghostty (Zig/C library)
Pipeline:
PTY bytes → libghostty (SIMD VT parser + grid + damage tracking) → C API → Rust FFI → IPC → WebViewSource: libghostty announcement, awesome-libghostty
Option D: Stay on xterm.js, upgrade to 7.0
Pipeline: Same as current, but with upstream fixes
pinnedToBottomscroll fix (PR #11102)Not viable
How Other Terminals Handle AI CLI Tools
pinnedToBottomflag (PR #11102)Recommendation
Short-term (now): Stay on xterm.js. Inject Claude Code env vars + implement Tabby-style scroll fix.
Medium-term (xterm.js 7.0): Upgrade when 7.0 releases with PR #5770 (DEC 2026 viewport fix).
Long-term (watch):
Related