From ba28827de5656f9f7f4fcbfd52313a6a4cedf372 Mon Sep 17 00:00:00 2001 From: Mikayla Maki Date: Tue, 9 Jul 2024 12:07:48 -0700 Subject: [PATCH] Add support for numpad keys on linux (#14018) Fixes https://github.com/zed-industries/zed/issues/12117 Partial application of the changes in https://github.com/zed-industries/zed/pull/13396 Release Notes: - N/A --- crates/gpui/src/platform/linux/platform.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/crates/gpui/src/platform/linux/platform.rs b/crates/gpui/src/platform/linux/platform.rs index f7c86399739339c06a752f391e77de5d93c0db50..9f613d1ca5b2fb00c14540a3fb2830d975ee9dc0 100644 --- a/crates/gpui/src/platform/linux/platform.rs +++ b/crates/gpui/src/platform/linux/platform.rs @@ -640,6 +640,8 @@ impl Keystroke { Keysym::Prior => "pageup".to_owned(), Keysym::Next => "pagedown".to_owned(), Keysym::ISO_Left_Tab => "tab".to_owned(), + Keysym::KP_Prior => "pageup".to_owned(), + Keysym::KP_Next => "pagedown".to_owned(), Keysym::comma => ",".to_owned(), Keysym::period => ".".to_owned(), @@ -677,7 +679,14 @@ impl Keystroke { Keysym::equal => "=".to_owned(), Keysym::plus => "+".to_owned(), - _ => xkb::keysym_get_name(key_sym).to_lowercase(), + _ => { + let name = xkb::keysym_get_name(key_sym).to_lowercase(); + if key_sym.is_keypad_key() { + name.replace("kp_", "") + } else { + name + } + } }; if modifiers.shift {