Skip to content

Commit

Permalink
macOS: Fix a regression in the previous release that caused a crash w…
Browse files Browse the repository at this point in the history
…hen pressing a unprintable key, such as the POWER key

Fixes #1997
  • Loading branch information
kovidgoyal committed Sep 24, 2019
1 parent 2a07b3f commit fb1c318
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
7 changes: 7 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ Changelog
|kitty| is a feature full, cross-platform, *fast*, GPU based terminal emulator.
To update |kitty|, :doc:`follow the instructions <binary>`.

0.14.6 [2019-09-23]
---------------------

- macOS: Fix a regression in the previous release that caused a crash when
pressing a unprintable key, such as the POWER key (:iss:`1997`)


0.14.5 [2019-09-23]
---------------------

Expand Down
10 changes: 6 additions & 4 deletions glfw/cocoa_window.m
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit fb1c318

Please sign in to comment.