fix: last RV11 gaps - bench enum args, theme NUL paths, Zig error names

Resolves the 3 remaining gaps in docs/rewrite/notes/review-rv11-codex.md
(final-Z14.md):
- ghostty-bench validates every occurrence of enum options in order
  (Args::take_enum; empty value resets) like cli/args.zig, so
  `--mode=bad --mode=noop` fails as in Zig.
- Theme paths with an interior NUL open the prefix like Zig's C-string
  path handling (verified against /usr/bin/ghostty).
- Filesystem diagnostics print Zig's error names (error.FileNotFound,
  NotDir, AccessDenied, IsDir, NameTooLong, SymLinkLoop, ...) via a
  shared ghostty_os::zig_error mapping used by theme/path/config-file/
  file_load/edit-config/list-themes; messages match the oracle.

Test Plan:
- cargo test --workspace --no-fail-fast
- just check-macos (both), just check-windows, just check-wasm
This commit is contained in:
ddidderr committed 2026-10-12 13:54:15 +02:00
1 parent ce9373aa7a
commit f9b333545a
12 files changed
+215 -89

No files matched your search

+1 -5
View File
@@ -122,11 +122,7 @@ fn exec_editor(stderr: &mut dyn Write, path: &EncodedOs) -> Result<u8, Error> {
.exec();
// If we reached this point then exec failed.
let err = match err.kind() {
std::io::ErrorKind::NotFound => "error.FileNotFound".to_string(),
std::io::ErrorKind::PermissionDenied => "error.AccessDenied".to_string(),
_ => err.to_string(),
};
let err = ghostty_os::zig_error::io_error_name(&err);
let msg = format!(
"Failed to execute the editor. Error code={err}.\n\
\n\
@@ -1396,11 +1396,9 @@ impl Preview {
fn error_name(e: &ghostty_config::config::Error) -> String {
use ghostty_config::config::Error;
match e {
Error::Io(io) => match io.kind() {
std::io::ErrorKind::NotFound => "FileNotFound".to_string(),
std::io::ErrorKind::PermissionDenied => "AccessDenied".to_string(),
_ => io.to_string(),
},
Error::Io(io) => ghostty_os::zig_error::io_error_name(io)
.trim_start_matches("error.")
.to_owned(),
e => e.to_string(),
}
}