Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
terminal_view: Forward ctrl-q to PTY when terminal is focused on Linux (#58879)
saberoueslati5cf706ceebe9
diff --git a/assets/keymaps/default-linux.json b/assets/keymaps/default-linux.jsonindex 8799e032bfa..f5c2bd2864f 100644--- a/assets/keymaps/default-linux.json+++ b/assets/keymaps/default-linux.json@@ -1240,6 +1240,7 @@"ctrl-c": ["terminal::SendKeystroke", "ctrl-c"],"ctrl-e": ["terminal::SendKeystroke", "ctrl-e"],"ctrl-o": ["terminal::SendKeystroke", "ctrl-o"],+ "ctrl-q": ["terminal::SendKeystroke", "ctrl-q"],"ctrl-w": ["terminal::SendKeystroke", "ctrl-w"],"ctrl-r": ["terminal::SendKeystroke", "ctrl-r"],"ctrl-backspace": ["terminal::SendKeystroke", "ctrl-w"],diff --git a/crates/terminal_view/src/terminal_view.rs b/crates/terminal_view/src/terminal_view.rsindex 3b1e6db97fc..a323da81b50 100644--- a/crates/terminal_view/src/terminal_view.rs+++ b/crates/terminal_view/src/terminal_view.rs@@ -2316,6 +2316,28 @@ mod tests {);}+ #[cfg(target_os = "linux")]+ #[gpui::test]+ async fn ctrl_q_is_forwarded_to_terminal_not_quit(cx: &mut TestAppContext) {+ let (project, _workspace, window_handle) = init_test_with_window(cx).await;+ cx.update(load_default_keymap);+ let (_pane, terminal, _terminal_view) =+ add_display_only_terminal(&project, window_handle, true, cx);++ let mut cx = VisualTestContext::from_window(window_handle.into(), cx);+ cx.update(|window, cx| {+ let _ = window.draw(cx);+ });+ cx.run_until_parked();++ cx.simulate_keystrokes("ctrl-q");+ assert_eq!(+ terminal.update(&mut cx, |terminal, _| terminal.take_input_log()),+ vec![vec![0x11]],+ "ctrl-q in a focused terminal should send 0x11 to the PTY, not trigger zed::Quit",+ );+ }+// Working directory calculation tests// No Worktrees in project -> home_dir()