zach-1de969
zach-1de969Closedinto main
4 commits · 19 files · +19 added
Description
Add acorn, a minimal wgpu terminal emulator
A small iTerm-like terminal for macOS aimed at vim/tmux/shell use, ~4.1k lines of Rust.
- Rendering: wgpu instanced quads (cell backgrounds, glyphs, decorations) with a shelf-packed glyph atlas; one WGSL shader.
- Fonts: system lookup via fontdb by family name or file path, real bold/italic faces (synthesized if missing), fallback chain for CJK/emoji/symbols, swash rasterization incl. color emoji. Box-drawing, block and powerline glyphs are drawn procedurally so lines join between cells.
- Emulation: vte parser feeding our own grid: 16/256/truecolor SGR, alt screen, scroll regions, insert/delete, tabs, DEC graphics, wide chars, bracketed paste, focus events, mouse reporting (X10/SGR), synchronized output, DECSCUSR, DA/DSR/DECRQM/OSC 4/10/11/52 responses.
- UI: multiple windows, scrollback, selection (drag/word/line), Cmd+C/V/N/W/K, font zoom, option-as-alt, login shell on a pty with reader/writer threads.
- Ligatures: text is drawn as shaped runs (split at spaces, style and color changes) with per-cell font fallback and a run cache;
font.ligaturestoggles liga/calt/clig/dlig. - Combining characters: zero-width chars attach to the previous cell through an interned mark table (Cell stays 16 bytes); the shaper composes or positions them, and accents the font leaves unpositioned are centered in their cell. U+FE0F prefers a color (emoji) font.
- Reflow: resizing re-wraps soft-wrapped lines across scrollback and the main screen, tracking the cursor and screen top; history scrolls to keep the space below the cursor unchanged.
- Cursor blink: DECSCUSR blink variants and a
terminal.cursor_blinkdefault (mode ?12 is ignored, since curses programs send ?12l via cnorm on every exit); timer-driven redraws only while a focused window has a blinking cursor; typing restarts the blink. - iTerm "Natural Text Editing" keys: Cmd+Left/Right (^A/^E), Cmd+Backspace (^U), Cmd+Delete (^K), Option+Left/Right (Esc-b/Esc-f), Option+Backspace (^W), Option+Delete (Esc-d); Cmd+Up/Down, Cmd+PageUp/PageDown, Cmd+Home/End scroll the scrollback.
- App icon: the leaf from Yarndings 20 (OFL) on a dark rounded square, drawn by macos/make-icon.swift (
make icon FONT=... GLYPH=h);make installputs Acorn.app in /Applications. - Config: ~/.config/acorn/config.toml (font, size, colors, palette, padding, shell, scrollback, cursor style).
- make app builds Acorn.app; cargo test covers the terminal state machine, reflow, combining marks and key/mouse encoding.
🤖 Generated with Claude Code
Commits4
- 344414be8c0c zach 1 month ago
- df74dca0d99d zach 1 month ago
- 147fcf20ec30 zach 1 month ago
- 95fc230caa8f zach 1 month ago
.gitignoreaddedView file
1+
/target/2+
.DS_Store3+
.oak/*Cargo.lockaddedView file
Loading diff…
Cargo.tomladdedView file
Loading diff…
MakefileaddedView file
Loading diff…
README.mdaddedView file
Loading diff…
macos/Acorn.icnsaddedView file
Loading diff…
macos/Info.plistaddedView file
Loading diff…
macos/make-icon.swiftaddedView file
Loading diff…
rustfmt.tomladdedView file
Loading diff…
src/boxdraw.rsaddedView file
Loading diff…
src/clipboard.rsaddedView file
Loading diff…
src/config.rsaddedView file
Loading diff…
src/font.rsaddedView file
Loading diff…
src/input.rsaddedView file
Loading diff…
src/main.rsaddedView file
Loading diff…
src/pty.rsaddedView file
Loading diff…
src/renderer.rsaddedView file
Loading diff…
src/shader.wgsladdedView file
Loading diff…
src/term.rsaddedView file
Loading diff…