From e724645057d4585ee0148b4f385e8c5bf35370ff Mon Sep 17 00:00:00 2001 From: ddidderr Date: Sun, 11 Oct 2026 21:54:18 +0200 Subject: [PATCH] docs(rewrite): track cross-crate integration TODOs and status --- docs/rewrite/INTEGRATION_TODO.md | 11 ++++++ docs/rewrite/STATUS.md | 17 ++++++---- docs/rewrite/notes/ghostty-config/files-a.md | 29 ++++++++++++++++ docs/rewrite/notes/ghostty-config/keybinds.md | 15 ++++++++ docs/rewrite/notes/ghostty-config/types-a.md | 34 +++++++++++++++++++ docs/rewrite/notes/ghostty-config/types-b.md | 19 +++++++++++ 6 files changed, 118 insertions(+), 7 deletions(-) create mode 100644 docs/rewrite/INTEGRATION_TODO.md create mode 100644 docs/rewrite/notes/ghostty-config/files-a.md create mode 100644 docs/rewrite/notes/ghostty-config/keybinds.md create mode 100644 docs/rewrite/notes/ghostty-config/types-a.md create mode 100644 docs/rewrite/notes/ghostty-config/types-b.md diff --git a/docs/rewrite/INTEGRATION_TODO.md b/docs/rewrite/INTEGRATION_TODO.md new file mode 100644 index 0000000..2d29c14 --- /dev/null +++ b/docs/rewrite/INTEGRATION_TODO.md @@ -0,0 +1,11 @@ +# Cross-crate integration TODOs + +Collected from agent reports; resolve during integration phases. + +- [ ] vt `osc/parsers/semantic_prompt.rs`: local printf-q / percent decoders → share with `ghostty-os::string_encoding` (vt can't depend on os; maybe move into vt and have os re-export). +- [ ] os `locale::ensure_locale` no-op → call setlocale from apprt-gtk (unsafe allowed) at startup, as Ghostty's global.zig does. +- [ ] os `passwd` Flatpak branch needs termio Pty. +- [ ] os `open::OpenUrlKind` → replace with core apprt action type. +- [ ] font `sprite/face.rs`: local `Presentation`/`RenderOptions` stand-ins → real font types (Phase 3). +- [ ] font crate: re-add deps on config/unicode/terminal in Phase 3. +- [ ] terminal crate: re-add deps on unicode/datastruct once those land. diff --git a/docs/rewrite/STATUS.md b/docs/rewrite/STATUS.md index 8bb9c7f..38d02e6 100644 --- a/docs/rewrite/STATUS.md +++ b/docs/rewrite/STATUS.md @@ -5,13 +5,16 @@ Legend: ⬜ todo · 🟨 in progress · ✅ done (gate passed, committed) · ⚠ | WP | Scope | Owner | State | Notes | |---|---|---|---|---| | P0 | scaffolding | opus | ✅ | | -| W1 | vt: parser/osc/color | sonnet | ⬜ | | -| W2 | vt: csi/sgr/modes/kitty/apc/dcs | sonnet | ⬜ | | -| W3 | unicode + datastruct | sonnet | ⬜ | | -| W4 | os | sonnet | ⬜ | | -| W5 | input | sonnet | ⬜ | | -| W6 | config | sonnet | ⬜ | | -| W7 | font: metrics + sprite | sonnet | ⬜ | | +| W1 | vt: parser/osc/color | sonnet | ✅ | | +| W2 | vt: csi/sgr/modes/kitty/apc/dcs | sonnet | ✅ | | +| W3 | unicode + datastruct | sonnet | 🟨 | | +| W4 | os | sonnet | ⚠️ | ensure_locale no-op, flatpak untested | | +| W5 | input | sonnet | 🟨 | | +| W6 | config | sonnet | 🟨 | | +| W7 | font: metrics + sprite | sonnet | ✅ | | +| S1 | vt: stream.zig + simd | sonnet | 🟨 | | +| T1 | terminal: size/point/style/hyperlink/rcset/page/PageList | codex astra | 🟨 | | ## Log - 2026-10-11: Phase 0 complete; Phase 1 launched. +- 2026-10-11: vt (W1+W2) and font sprite (W7) committed; S1 + T1 launched. diff --git a/docs/rewrite/notes/ghostty-config/files-a.md b/docs/rewrite/notes/ghostty-config/files-a.md new file mode 100644 index 0000000..f04bd7e --- /dev/null +++ b/docs/rewrite/notes/ghostty-config/files-a.md @@ -0,0 +1,29 @@ +# ghostty-config: small files (fork A) + +Ported (Zig -> Rust, in crates/ghostty-config/src): command.zig->command.rs, +path.zig->path.rs, url.zig->url.rs, string.zig->string.rs, io.zig->io.rs, +RepeatableStringMap.zig->repeatable_string_map.rs, +ClipboardCodepointMap.zig->clipboard_codepoint_map.rs, theme.zig->theme.rs, +edit.zig->edit.rs, file_load.zig->file_load.rs; config-template copied. + +Tests: all Zig tests ported (command 9, path 9, string 10, io 3, repeatable_string_map 4, +url regex 1 (80 cases + 10 no-match)); a handful of extra tests. 118 pass in a scratch crate +(with a ghostty-os shim; real ghostty-os didn't compile at the time). +clipboard_codepoint_map.zig and theme/edit/file_load have no Zig tests. + +Deviations +- No arenas: owned Strings. `clone`/`equal` = derive Clone/PartialEq (RepeatableStringMap has a manual order-insensitive PartialEq). +- url.rs: `REGEX` is built with `const_format::concatcp!`. The pattern needs Oniguruma + (variable-length lookbehind); `onig` is a dev-dependency used only by the test. The renderer/link + code must use the `onig` crate (add it as a normal dependency there). +- macOS app-support paths (file_load/edit) omitted. +- theme.rs: Zig reads `global_state.resources_dir.app()`; here it's an explicit + `resources_dir: Option<&str>` parameter (`theme::open`, `LocationIterator::new`). + `LocationIterator::next_location()` (not `next`) to satisfy clippy. +- Error text in diagnostics uses Rust io::Error Display instead of Zig `error.Name`. +- `Command::arg_iterator` shell splitting is a hand-written equivalent of ArgIteratorGeneral(.{}). +- Zig `u21` codepoints are `u32` (string.rs, clipboard_codepoint_map.rs). + +TODO(integration) +- clipboard_codepoint_map::Entry/Replacement mirror terminal/formatter.zig CodepointMap; swap for ghostty-terminal's. +- Config::expand_paths should call `Path::expand` / `RepeatablePath::expand(base, &mut diags)`. diff --git a/docs/rewrite/notes/ghostty-config/keybinds.md b/docs/rewrite/notes/ghostty-config/keybinds.md new file mode 100644 index 0000000..5ba2443 --- /dev/null +++ b/docs/rewrite/notes/ghostty-config/keybinds.md @@ -0,0 +1,15 @@ +# Keybinds (fork C) + +- `Config.Keybinds` -> `crates/ghostty-config/src/keybinds.rs`. +- Struct: `set: Set`, `tables: Vec<(String, Set)>` (insertion ordered), `chain_target: ChainTarget`. +- `init()` = Linux/GTK default table only (darwin branches dropped), same insertion order as Zig. +- `ConfigField`: `parse_cli` (clear, empty -> init, `name/` tables, `chain=` target tracking), `reset` -> `init()`, `format_entry` / `format_entry_docs`. +- `PartialEq` follows Zig `equal`/`equalSet` (ignores reverse map and chain state). +- Formatting uses `ghostty_input::binding::set::Value::format_entries` through an adapter to `EntryFormatter`. +- Errors from input's `binding::Error` map to `ArgError::Other("InvalidFormat"|"InvalidAction")`. +- Tests: 31 ported/added (all Zig tests in range ported, 0 skipped; plus `reset_calls_init`, `default_keybinds_format_roundtrip`). + +Quirks +- `format_entry_docs(docs=true)`: Zig looks up help via `@tagName(v)` of the set Value (leader/leaf/leaf_chained), which never matches a keybind action, so only a blank line is emitted. Preserved. +- `Keybinds::default()` is EMPTY (Zig `.{}`); Config::default must call `init()`. +- Input's `Set` has no PartialEq; equality is implemented locally. diff --git a/docs/rewrite/notes/ghostty-config/types-a.md b/docs/rewrite/notes/ghostty-config/types-a.md new file mode 100644 index 0000000..1c64393 --- /dev/null +++ b/docs/rewrite/notes/ghostty-config/types-a.md @@ -0,0 +1,34 @@ +# ghostty-config: types_a.rs / font_types.rs (fork B1) + +Ported from Config.zig 5196-6376 and 7922-8566: +ConfirmCloseSurface, CustomShaderAnimation, NonNativeFullscreen, Fullscreen, +WindowPaddingColor, WindowSubtitle, LinkPreviews, WorkingDirectory, Color, +TerminalColor, BoldColor, ColorList, Palette, RepeatableString, +SelectionWordChars, RepeatableFontVariation, RepeatableCodepointMap, +RepeatableClipboardCodepointMap, FontStyle, FontSyntheticStyle, +FontShapingBreak, RepeatableLink, plus `CursorStyle` (from terminal/cursor.zig). + +`font_types.rs`: local `Variation`/`VariationId`, `Descriptor`, `CodepointMap` +(+`CodepointMapEntry`) — ghostty-font should re-use these. + +## API notes +- Zig static `X.parseCLI(input)` constructors are `Color::from_cli`, + `TerminalColor::from_cli`, `BoldColor::from_cli` (the trait method + `parse_cli(&mut self, ..)` wraps them). `Color::from_hex`, `format_buf`, + `to_terminal_rgb` exist. `WorkingDirectory::finalize()` takes no allocator. +- Codepoints are `u32` (no u21 in Rust); parsing range-checks to <= 0x1FFFFF. +- `RepeatableString` PartialEq ignores `overwrite_next` (as Zig `equal`). +- Type-specific Zig errors (Overflow, InvalidCharacter, NotImplemented) are + `ArgError::Other("")` without the `error.` prefix; core cli_args + prints `unknown error `. Zig prints `error.` there; core may want + to add the prefix. +- Skipped: C API (`cval`, `*_c`), `enum(c_int)`, getGObjectType. +- UnicodeRangeParser is `pub(crate)` in types_a (`next_range`). +- RepeatableLink.parse_cli always errors `NotImplemented` (as Zig). + +## Tests +All Zig tests in the ranges ported (WorkingDirectory 2, Color 4, TerminalColor 2, +BoldColor 2, ColorList 3, Palette 5, RepeatableString 5, SelectionWordChars 4, +RepeatableFontVariation 3, RepeatableCodepointMap 4, RepeatableClipboardCodepointMap 5, +FontStyle 4) plus extras, and font_types (Variation.Id x2, codepointmap). None skipped. +Test names are nested in per-type modules (`tests::color::parse_cli_with_whitespace`). diff --git a/docs/rewrite/notes/ghostty-config/types-b.md b/docs/rewrite/notes/ghostty-config/types-b.md new file mode 100644 index 0000000..da0a998 --- /dev/null +++ b/docs/rewrite/notes/ghostty-config/types-b.md @@ -0,0 +1,19 @@ +# ghostty-config: types_b.rs (Config.zig 8566-10250) + +Ported: CopyOnSelect .. NotifyOnCommandFinishAction (all enums via config_enum!, packed structs via +config_packed!), RepeatableCommand, MouseScrollMultiplier, QuickTerminalSize (+Value, Dimensions), +BackgroundBlur, WindowDecoration, Theme, Duration, WindowPadding, AlphaBlending::is_linear. + +Tests: 21 ported/added (all Zig tests in range except 2 skipped: "RepeatableCommand cval", "RepeatableCommand cval cleared" -- C API). + +Deviations / notes: +- OSCColorReportFormat variants are `Bit8`/`Bit16` ("8-bit"/"16-bit"). Enum variants for `false`/`true`/`none` are `False`/`True`/`None`. +- WindowDecoration, Duration, WindowPadding have inherent `parse(Option<&str>)` (Zig 1-arg parseCLI) used by ConfigField::parse_cli. +- QuickTerminalSize is `{primary, secondary: Option}`; formats nothing when primary is None (as Zig). +- Skipped C-API: cval/C structs, getGObjectType, c_int discriminants. +- GtkSingleInstance::DEFAULT, MouseScrollMultiplier::DEFAULT mirror Zig `default` consts (Default::default for MouseScrollMultiplier is 1/3). + +TODO(integration): +- `Command` is a local shim (action: ghostty_input::binding::Action, title, description) with `Command::parse_auto`; replace with ghostty_input::command::Command when it exists (input/command.rs was a stub). +- `default_commands()` returns an empty Vec; must return ghostty_input::command::defaults (used by RepeatableCommand::reset == Zig `init`). +- Requires ghostty_input::binding::Action: Display, PartialEq, Clone, parse().