Files
ghostty-rs/docs/rewrite/notes/compat-GC-cli.md
T
ddidderr f2252bb165 feat: port GTK version fallbacks, helpgen, bench modes, CLI leftovers
- apprt-gtk: Ghostty's runtime+build-time version gating (at_least)
  with cargo features adw_1_3/adw_1_4/adw_1_5/gtk_4_16 (default on) and
  the fallbacks for older libraries: MessageDialog (adw < 1.5),
  clipboard dialog without SwitchRow, pre-Banner debug warning and
  child-exited widgets, the old about dialog, GTK 4.16 CSS error source
  bytes. The minimum stays GTK 4.14 / libadwaita 1.5 (Ghostty's floor).
  The root build links with -z lazy so version-gated symbols don't keep
  older libraries from loading.
- ghostty-helpgen (port of helpgen.zig) generates CLI action help and
  keybinding action docs from doc comments at build time, replacing the
  checked-in help/*.txt; +help and +list-actions --docs stay
  byte-identical to Ghostty 1.3.1.
- ghostty-bench: libc wcwidth mode and separate simd/table and
  uucode/table code paths like Zig.
- ghostty-cli: Windows branches of edit-config, list-colors,
  list-keybinds and boo; ssh-cache DiskCache flock locking (no-op on
  Windows, as in Zig) with an exclusivity test.

Test Plan:
- cargo test --workspace
- diff <(cargo run -q -- +list-actions --docs) \
  <(ghostty +list-actions --docs)
2026-10-12 06:38:33 +02:00

1.7 KiB

compat-GC: ghostty-cli Windows branches and DiskCache locking

Ported (all cfg(windows) / cfg-gated, no unsafe, no new deps):

  • edit_config.rs: Windows prints "not supported on Windows ... edit manually at " to stderr and returns 1 (after the path lookup, before the editor lookup, as in Zig). The exec path is now cfg(unix) (exec_editor).
  • list_colors.rs / list_keybinds.rs: both use tui::window_size(); on Windows it returns the fixed Zig default (120 cols x 24 rows) instead of querying the tty. Pixel size (1024x768) is not modelled (unused).
  • boo.rs: Zig allows windows/macos/linux/freebsd and returns 1 elsewhere; mirrored with a cfg! check. Windows needs no other change.
  • ssh_cache/disk_cache.rs: made the module compile on Windows (unix-only mode/PermissionsExt gated; fixup_permissions is a no-op on Windows as in Zig "Windows does not support chmod").

Locking deviation from the task brief: Zig does NOT lock on Windows (if (comptime builtin.os.tag != .windows) file.tryLock(.exclusive) and the matching unlock). So the faithful port is a no-op lock on Windows rather than LockFileEx; hence no windows-sys/unsafe. On unix the existing implementation already matched Zig: File::try_lock (flock LOCK_EX|LOCK_NB), WouldBlock is ignored (proceeds unlocked, as Zig ignores the bool), other errors -> CacheIsLocked, unlock on drop.

Tests: unix lock_is_exclusive_until_dropped; windows-only lock_is_noop_on_windows (compiled only); permission assertion split into unix-only disk_cache_file_permissions.

Verified: build/test(92)/clippy -D warnings on linux; cargo check --target x86_64-pc-windows-gnu --tests -p ghostty-cli and windows clippy clean (stub fontconfig.pc, RUSTC_WRAPPER= as in windows-WIN.md).