mirror of
https://github.com/kovidgoyal/kitty
synced 2026-06-08 14:18:26 +02:00
macOS: Fix a regression in the previous release that caused a crash when pressing a unprintable key, such as the POWER key
Fixes #1997
This commit is contained in:
@@ -345,10 +345,12 @@ static int translateKey(unsigned int key, bool apply_keymap)
|
||||
// Look for the effective key name after applying any keyboard layouts/mappings
|
||||
const char *name_chars = _glfwPlatformGetScancodeName(key);
|
||||
uint32_t name = 0;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if (!name_chars[i]) break;
|
||||
name <<= 8;
|
||||
name |= (uint8_t)name_chars[i];
|
||||
if (name_chars) {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if (!name_chars[i]) break;
|
||||
name <<= 8;
|
||||
name |= (uint8_t)name_chars[i];
|
||||
}
|
||||
}
|
||||
if (name) {
|
||||
// Key name
|
||||
|
||||
Reference in New Issue
Block a user