Ports ZIG/src/config (minus C/WASM APIs) and cli/{args,CommaSplitter,
diagnostics}.zig into ghostty-config:
- all 202 options with exact names, types, defaults and verbatim docs,
declared through one config_struct! macro; Zig's comptime reflection is
replaced by the ConfigField/CliTarget traits
- loading: default XDG files, -e, config-file includes (optional '?',
cycle detection), themes incl. light:/dark: pairs, conditional config,
replay, finalize() derived defaults, clone/changed diffing for reload
- Linux/GTK default keybinds built on ghostty_input::binding::Set
- formatter producing +show-config output
Verified against the installed Ghostty 1.3.1: `+show-config --default`
and `--default --docs` match byte for byte (except gtk-opengl-debug,
which differs between debug/release builds), as do two complex loaded
configs.
Open items (docs/rewrite/notes/ghostty-config.md): url regex needs an
Oniguruma-compatible engine (onig) in the renderer; some font/terminal
types are local copies awaiting integration; KeyRemapSet equality is
order sensitive unlike Zig.
Test Plan:
- cargo test -p ghostty-config (255 tests)
- compare `ghostty +show-config --default --docs` with our formatter
26 lines
501 B
Rust
26 lines
501 B
Rust
//! Port of `config/ErrorList.zig`.
|
|
|
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
pub struct Error {
|
|
pub message: String,
|
|
}
|
|
|
|
/// The list of errors.
|
|
#[derive(Debug, Clone, PartialEq, Eq, Default)]
|
|
pub struct ErrorList {
|
|
pub list: Vec<Error>,
|
|
}
|
|
|
|
impl ErrorList {
|
|
/// True if there are no errors.
|
|
#[must_use]
|
|
pub fn empty(&self) -> bool {
|
|
self.list.is_empty()
|
|
}
|
|
|
|
/// Add a new error to the list.
|
|
pub fn add(&mut self, err: Error) {
|
|
self.list.push(err);
|
|
}
|
|
}
|