T44: herdr's shortcuts work, which a user found dead: under kitty's flags a key Shift makes a symbol of goes as its own key with Shift, the symbol its alternate, as Ghostty sends it, read from the layout gpui reads on macOS and Windows; on Windows keys that type no text go as win32-input-mode records, which ConPTY asks for and herdr reads, as Windows Terminal sends them; on Linux gpui keeps no key code, which the docs say; shot learns wait, n and ]
CI / platforms (windows-latest) (push) Failing after 19s
CI / macos (push) Failing after 2m56s
CI / platforms (ubuntu-24.04) (push) Successful in 6m41s

This commit is contained in:
ZacharyZhang-NY committed 2026-10-18 04:00:24 -04:00
1 parent 8d7e730a78
commit fc10c4d491
19 files changed
+548 -118

No files matched your search

+56
View File
@@ -12,6 +12,7 @@ fn key(spec: &'static str, text: &'static str) -> Key<'static> {
alt: parts.contains(&"alt"),
platform: parts.contains(&"cmd"),
action: Action::Press,
unshifted: None,
}
}
@@ -296,6 +297,61 @@ fn flags_that_only_add_fields_keep_legacy_keys() {
);
}
#[test]
fn kitty_reports_the_key_shift_turned_into_a_symbol() {
// gpui names Shift-[ by its `{` and drops Shift; the platform gives back `[`.
let made = |spec, text, action| Key {
unshifted: Some('['),
action,
..key(spec, text)
};
let herdr = Kitty {
events: true,
alternates: true,
..DISAMBIGUATE
};
assert_eq!(
kitty(made("cmd+ctrl+{", "", Action::Press), herdr).as_deref(),
Some("\x1b[91:123;14u")
);
assert_eq!(
kitty(made("cmd+ctrl+{", "", Action::Release), herdr).as_deref(),
Some("\x1b[91:123;14:3u")
);
assert_eq!(
kitty(made("ctrl+{", "", Action::Press), DISAMBIGUATE).as_deref(),
Some("\x1b[91;6u")
);
assert_eq!(
kitty(made("{", "{", Action::Press), herdr),
None,
"it types"
);
let all = Kitty {
all: true,
alternates: true,
..DISAMBIGUATE
};
assert_eq!(
kitty(made("{", "{", Action::Press), all).as_deref(),
Some("\x1b[91:123;2u")
);
assert_eq!(
legacy(made("ctrl+{", "", Action::Press), false).as_deref(),
Some("\x1b[123;5u"),
"legacy keeps fixterms' shifted character"
);
let same = Key {
unshifted: Some('7'),
..key("ctrl+7", "")
};
assert_eq!(
kitty(same, herdr).as_deref(),
Some("\x1b[55;6u"),
"no alternate where Shift made the same character"
);
}
#[test]
fn super_is_kittys_eighth_bit() {
let events = Kitty {