Skip to content

Conversation

@sreya
Copy link
Contributor

@sreya sreya commented Nov 20, 2025

No description provided.

- Make terminal.options public and mutable with Proxy interception
- Make open() synchronous (WASM pre-loads in constructor)
- Add windowsMode and allowProposedApi options for xterm.js compatibility
- Add unicode.activeVersion property
- Add onReady event that fires immediately for late subscribers
- Implement event-based FitAddon auto-retry (no timers)
- Add write queueing for data sent before WASM loads
- Support runtime option changes (disableStdin, windowsMode, etc)
- Fix: setupTerminal uses this.cols/rows instead of options.cols/rows

Breaking changes:
- open() is now synchronous (remove await keyword)
- options is now public (was private)
- WASM loading starts in constructor (slight startup cost)

This enables true zero-friction migration from xterm.js - just change
the import statement and all existing code works unchanged.

Includes comprehensive test suite (18 xterm.js compatibility tests).

Fixes resize issue where PTY was created before FitAddon could update
terminal dimensions. Now term.cols/rows are used when creating WASM
terminal, ensuring correct initial size.
- Add 15 new tests in lib/new-features.test.ts
- Tests cover: onReady event, write queueing, FitAddon auto-retry,
  runtime option propagation, WASM pre-loading, initial sizing
- Add FEATURES_TESTING_GUIDE.md documenting all 11 features and their tests
- Total test coverage: 33 tests for all new functionality
- Add public options, unicode, onReady, write queueing tests to lib/terminal.test.ts
- Add FitAddon onReady auto-retry tests to lib/addons/fit.test.ts
- Remove standalone test files (xterm-compat.test.ts, new-features.test.ts)
- All new features now have unit test coverage in appropriate files
Add comprehensive functional tests that verify actual behavior:

Terminal tests (21 new tests):
- disableStdin: Verifies paste/input are blocked when enabled, can toggle at runtime
- onReady event: Fires after WASM loads, late subscribers fire immediately,
  multiple subscribers all receive event, wasmTerm is available
- Write queueing: Writes before ready are queued and processed, callbacks work
- Synchronous open(): Returns immediately, element/cols/rows available,
  FitAddon can update dimensions before ready

FitAddon tests (6 new tests):
- onReady subscription: Subscribes during activation, calls fit() when ready
- Resource cleanup: Disposes subscription on dispose
- Dimension calculation: Correct cols/rows including scrollbar space

These tests verify functionality rather than just checking property values.
The synchronous open() API change requires tests to explicitly wait for
WASM to be ready before accessing wasmTerm or WASM-dependent features.

Changes:
- Add openAndWaitForReady() helper to terminal.test.ts, buffer.test.ts,
  and scrolling.test.ts
- Update 68 tests in terminal.test.ts to use the helper
- Update 4 tests in scrolling.test.ts to use the helper
- Update 1 test in buffer.test.ts to use the helper
- Fix 'cannot open twice' and 'cannot open after disposal' tests to use
  synchronous throw assertions (open() now throws synchronously)

All 268 tests now pass.
Remove non-functional xterm.js compatibility options:
- Remove allowProposedApi (was no-op, no APIs to gate)
- Remove windowsMode (affects buffer reflow, not implementable without WASM changes)

Add functional tests for Options Proxy handleOptionChange:
- Test cursorStyle change updates renderer.cursorStyle
- Test cursorBlink change starts/stops blink timer
- Test cols/rows change triggers resize event
- Test options can be changed before terminal is open

Add functional tests for disableStdin with real keyboard events:
- Test blocks real KeyboardEvent when disableStdin is true
- Test allows real KeyboardEvent when disableStdin is false
- Test keyboard blocked after runtime toggle to disableStdin=true

All 273 tests pass.
@sreya sreya merged commit 1680deb into main Nov 24, 2025
5 checks passed
@sreya sreya deleted the replace-xtermjs-ghostty-web branch November 24, 2025 23:51
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.

1 participant