Commit a411cd0c

a411cd0cb7b1Mergedfrom zach-1de969

zach · 1 month ago · 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.ligatures toggles 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_blink default (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 install puts 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

Details

Commit
a411cd0cb7b1
Parent
None
Merge parent
344414be8c0c

.gitignoreaddedView file

1+/target/
2+.DS_Store
3+.oak/*