feat(input): port keyboard, keybinding and mouse input handling

Ports ZIG/src/input (except macOS keymaps) into ghostty-input:
- key, key_mods (incl. RemapSet), the physical keycode table
- key_encode: legacy, modifyOtherKeys and kitty keyboard protocol
  encoders, function key tables
- Binding: all keybinding actions with their user-visible docs (for
  +list-actions), triggers, sets with sequences, chains, leader keys and
  key tables, and formatting back to config strings
- command palette defaults, mouse, paste safety checks, kitty helpers,
  links, helpgen action docs

Deviations (docs/rewrite/notes/ghostty-input.md): Mods.super is named
super_; case folding uses char::to_lowercase plus Ghostty's special
cases instead of uucode tables; chain parents are trigger paths instead
of pointers; a Zig bug where chained leaves inside sequences corrupted the
shared prefix when formatting is fixed (covered by a test).

Integration left: building encode/paste Options from terminal modes,
and implementing the EntryFormatter trait in ghostty-config.

Test Plan:
- cargo test -p ghostty-input (220 tests; 8 macOS-only skipped)
- cargo clippy -p ghostty-input --all-targets -- -D warnings
This commit is contained in:
ddidderr committed 2026-10-11 21:56:07 +02:00
1 parent 5b8c92b98c
commit e03432241b
21 files changed
+13413 -1

No files matched your search

+26 -1
View File
@@ -1 +1,26 @@
//! ghostty-input: see docs/rewrite/ARCHITECTURE.md for the module map.
//! ghostty-input: keyboard/mouse input handling (ZIG/src/input/*).
pub mod binding;
pub mod command;
pub mod config;
pub mod function_keys;
pub mod helpgen_actions;
pub mod key;
pub mod key_encode;
pub mod key_mods;
pub mod keyboard;
pub mod keycodes;
pub mod kitty;
pub mod link;
pub mod mouse;
pub mod paste;
pub use config::OptionAsAlt;
pub use key::{Action, Key, KeyEvent, ctrl_or_super};
pub use key_mods::{Mods, RemapSet as KeyRemapSet};
pub use keyboard::Layout as KeyboardLayout;
pub use link::Link;
pub use mouse::{
Button as MouseButton, ButtonState as MouseButtonState, PressureStage as MousePressureStage,
ScrollMods,
};