From f021be623eb73822e7da03369ffb99377e45d82f Mon Sep 17 00:00:00 2001 From: Reilly Wood <26268125+rgwood@users.noreply.github.com> Date: Thu, 7 Sep 2023 10:47:17 -0700 Subject: [PATCH] Exit explore on ctrl+c/d/q (#10257) Currently, `ctrl+z` is the command to exit `explore` no matter where you are in the UI. IMO this is a bit unintuitive since that's usually used to suspend a process. After this change, `ctrl+c`, `ctrl+d`, and `ctrl+q` all work to exit `explore`. I think these are all shortcuts that users might try when attempting to exit `explore`, and I think we might as well handle them all. --- crates/nu-explore/src/pager/mod.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/crates/nu-explore/src/pager/mod.rs b/crates/nu-explore/src/pager/mod.rs index 59f843c195..d2cc8e18de 100644 --- a/crates/nu-explore/src/pager/mod.rs +++ b/crates/nu-explore/src/pager/mod.rs @@ -781,14 +781,13 @@ fn handle_event( } fn handle_exit_key_event(key: &KeyEvent) -> bool { - matches!( - key, - KeyEvent { - code: KeyCode::Char('z'), - modifiers: KeyModifiers::CONTROL, - .. + if key.modifiers == KeyModifiers::CONTROL { + // these are all common things people might try, might as well handle them all + if let KeyCode::Char('c') | KeyCode::Char('d') | KeyCode::Char('q') = key.code { + return true; } - ) + } + false } fn handle_general_key_events1(