From 959f0dcded71991089def013e05f83d9ac640266 Mon Sep 17 00:00:00 2001 From: apricotbucket28 <71973804+apricotbucket28@users.noreply.github.com> Date: Mon, 3 Jun 2024 15:25:27 -0300 Subject: [PATCH] Fix terminal key bindings (#12558) Fixes https://github.com/zed-industries/zed/issues/12556 Only changed the keymap on Linux since I'm not sure if the behaviour is correct on macOS Release Notes: - N/A --- assets/keymaps/default-linux.json | 7 +------ crates/terminal/src/mappings/keys.rs | 1 + 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/assets/keymaps/default-linux.json b/assets/keymaps/default-linux.json index bc5f14b00e..8bb8753d97 100644 --- a/assets/keymaps/default-linux.json +++ b/assets/keymaps/default-linux.json @@ -642,12 +642,7 @@ "pagedown": ["terminal::SendKeystroke", "pagedown"], "escape": ["terminal::SendKeystroke", "escape"], "enter": ["terminal::SendKeystroke", "enter"], - "ctrl-c": ["terminal::SendKeystroke", "ctrl-c"], - - // Some nice conveniences - "ctrl-backspace": ["terminal::SendText", "\u0015"], - "ctrl-right": ["terminal::SendText", "\u0005"], - "ctrl-left": ["terminal::SendText", "\u0001"] + "ctrl-c": ["terminal::SendKeystroke", "ctrl-c"] } } ] diff --git a/crates/terminal/src/mappings/keys.rs b/crates/terminal/src/mappings/keys.rs index 250e0c5e5c..e760db3616 100644 --- a/crates/terminal/src/mappings/keys.rs +++ b/crates/terminal/src/mappings/keys.rs @@ -54,6 +54,7 @@ pub fn to_esc_str(keystroke: &Keystroke, mode: &TermMode, alt_is_meta: bool) -> ("backspace", AlacModifiers::None) => Some("\x7f".to_string()), //Interesting escape codes ("tab", AlacModifiers::Shift) => Some("\x1b[Z".to_string()), + ("backspace", AlacModifiers::Ctrl) => Some("\x08".to_string()), ("backspace", AlacModifiers::Alt) => Some("\x1b\x7f".to_string()), ("backspace", AlacModifiers::Shift) => Some("\x7f".to_string()), ("space", AlacModifiers::Ctrl) => Some("\x00".to_string()),