Skip to content

feat: implement Buffer Access API #31

Merged
sreya merged 1 commit into
mainfrom
xterm
Nov 16, 2025
Merged

feat: implement Buffer Access API #31
sreya merged 1 commit into
mainfrom
xterm

Conversation

@sreya
Copy link
Copy Markdown
Contributor

@sreya sreya commented Nov 16, 2025

Add xterm.js-compatible buffer API for reading terminal state:

  • IBufferNamespace with active/normal/alternate buffers
  • IBuffer with cursor position and line access
  • IBufferLine with cell access and string conversion
  • IBufferCell with full style/color properties

Implementation:

  • lib/buffer.ts (365 lines) - Buffer API classes
  • lib/buffer.test.ts (457 lines) - 41 comprehensive tests
  • lib/interfaces.ts - Buffer interface definitions
  • lib/terminal.ts - Integrated term.buffer property

Features:

  • Lazy initialization with caching
  • Full Unicode support (emoji, CJK, accents)
  • All text styles (bold, italic, underline, etc.)
  • RGB color support
  • Line wrapping detection
  • Zero logic duplication (delegates to WASM)

Tests: 190/190 passing (41 new buffer tests)

Add xterm.js-compatible buffer API for reading terminal state:
- IBufferNamespace with active/normal/alternate buffers
- IBuffer with cursor position and line access
- IBufferLine with cell access and string conversion
- IBufferCell with full style/color properties

Implementation:
- lib/buffer.ts (365 lines) - Buffer API classes
- lib/buffer.test.ts (457 lines) - 41 comprehensive tests
- lib/interfaces.ts - Buffer interface definitions
- lib/terminal.ts - Integrated term.buffer property

Features:
- Lazy initialization with caching
- Full Unicode support (emoji, CJK, accents)
- All text styles (bold, italic, underline, etc.)
- RGB color support
- Line wrapping detection
- Zero logic duplication (delegates to WASM)

Tests: 190/190 passing (41 new buffer tests)
API Parity: ~73% → ~78%
@sreya sreya merged commit 37a6ce8 into main Nov 16, 2025
5 checks passed
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