macOS: fix upper cased letter is not correctly mapped to menu shortcut

pull/12039/head
Lukas 2026-04-01 14:50:53 +02:00
parent b7e56044db
commit 702a2b43c3
No known key found for this signature in database
GPG Key ID: 1944A0A77B561220
2 changed files with 20 additions and 2 deletions

View File

@ -29,8 +29,11 @@ extension Ghostty {
}
case GHOSTTY_TRIGGER_UNICODE:
guard let scalar = UnicodeScalar(trigger.key.unicode) else { return nil }
key = KeyEquivalent(Character(scalar))
guard
let scalar = UnicodeScalar(trigger.key.unicode),
let normalized = Character(scalar).lowercased().first
else { return nil }
key = KeyEquivalent(normalized)
case GHOSTTY_TRIGGER_CATCH_ALL:
// catch_all matches any key, so it can't be represented as a KeyboardShortcut

View File

@ -220,4 +220,19 @@ struct ConfigTests {
#expect(config.maximize == true)
#expect(config.focusFollowsMouse == true)
}
@Test
func uppercasedLetterShouldBeNormalized() async throws {
let config = try TemporaryConfig("""
keybind=cmd+L=goto_split:left
""")
let shortcut = try #require(config.keyboardShortcut(for: "goto_split:left"))
#expect(shortcut == .init("l", modifiers: [.command]))
let config2 = try TemporaryConfig("""
keybind=cmd+Ä=goto_split:left
""")
let shortcut2 = try #require(config2.keyboardShortcut(for: "goto_split:left"))
#expect(shortcut2 == .init("ä", modifiers: [.command]))
}
}