docs(rewrite): track cross-crate integration TODOs and status

This commit is contained in:
ddidderr committed 2026-10-11 21:54:18 +02:00
1 parent f8c5ce06d6
commit b96984b020
6 files changed
+118 -7

No files matched your search

@@ -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)`.
@@ -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.
@@ -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("<name>")` without the `error.` prefix; core cli_args
prints `unknown error <name>`. Zig prints `error.<name>` 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`).
@@ -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<QuickTerminalSizeValue>}`; 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().