Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
41a3752
fix: zero-initialize WASM page buffers to prevent memory corruption (…
sauyon Mar 22, 2026
043f1b0
Remove auto-focus from Terminal.open()
sauyon Apr 1, 2026
ba124a6
Preserve scroll position when new output arrives
sauyon Apr 5, 2026
9d0870e
Fix GhosttyTerminalConfig.scrollbackLimit docs
sauyon Apr 7, 2026
3245b78
feat: allow injecting an existing GhosttyTerminal into Terminal
sauyon Apr 17, 2026
190ebe7
refactor(input): route every keydown through the Ghostty encoder
sauyon Apr 21, 2026
ace716f
fix(renderer): correct font metrics + procedural box-drawing for U+25…
sauyon May 8, 2026
b514406
fix(box-drawing): derive stroke thickness from font's '─' glyph
sauyon May 8, 2026
b707a01
refactor(box-drawing): port block.zig structure to blocks.ts
sauyon May 8, 2026
ca7a320
fix(box-drawing): vertical-dash asymmetry + dash gap, add test coverage
sauyon May 8, 2026
40b02b2
refactor(box-drawing): consolidate into a single file
sauyon May 8, 2026
ef45ab1
fix: drop redundant canvas resize in terminal.ts; tighten box-drawing…
sauyon May 8, 2026
44e2c17
fix(renderer): clear() coordinate-space mismatch + doc/test polish
sauyon May 9, 2026
0a3f01d
fix(box-drawing): defensive bounds + cleanup remaining review nits
sauyon May 9, 2026
c3da27b
fix(renderer): keep FontMetrics.boxThickness as an additive change
sauyon May 9, 2026
2e20094
fix(box-drawing): export public API + harden inputs + tighten weak tests
sauyon May 10, 2026
f390d37
fix: sixth-pass nits — test variable naming, JSDoc, type cleanliness
sauyon May 10, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,25 @@ xterm.js is everywhere—VS Code, Hyper, countless web terminals. But it has fun

xterm.js reimplements terminal emulation in JavaScript. Every escape sequence, every edge case, every Unicode quirk—all hand-coded. Ghostty's emulator is the same battle-tested code that runs the native Ghostty app.

### Keyboard encoding

Keyboard input is encoded by Ghostty's key encoder. Byte sequences largely match xterm.js's defaults — Home/End honor DECCKM, Shift+nav and Shift+F-keys preserve the Shift modifier in the emitted CSI sequence, non-BMP characters pass through, Arrow keys honor cursor-application mode. Two deliberate differences:

- **Shift+Enter is distinguishable from Enter** (emitted as `\x1b[27;2;13~` rather than bare `\r`, following fixterms), so modern line editors and REPLs can treat Shift+Enter as a newline-without-submit.
- **Kitty keyboard protocol and xterm modifyOtherKeys state 2 are supported** when an app enables them. xterm.js implements only the traditional escape sequences.

If you need byte-for-byte xterm.js behavior for a specific key (e.g. Shift+Enter mapped to `\r` for tools that don't understand the fixterms sequence), intercept it in `attachCustomKeyEventHandler` and emit the bytes you want via `term.input(bytes, true)`:

```ts
term.attachCustomKeyEventHandler((e) => {
if (e.key === 'Enter' && e.shiftKey && !e.ctrlKey && !e.altKey && !e.metaKey) {
term.input('\r', true); // fires onData with '\r'
return true; // suppress the default encoder path
}
return false;
});
```

## Installation

```bash
Expand Down
Loading