forked from extern/nushell
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.
This commit is contained in:
parent
b6189879e3
commit
f021be623e
@ -781,14 +781,13 @@ fn handle_event<V: View>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn handle_exit_key_event(key: &KeyEvent) -> bool {
|
fn handle_exit_key_event(key: &KeyEvent) -> bool {
|
||||||
matches!(
|
if key.modifiers == KeyModifiers::CONTROL {
|
||||||
key,
|
// these are all common things people might try, might as well handle them all
|
||||||
KeyEvent {
|
if let KeyCode::Char('c') | KeyCode::Char('d') | KeyCode::Char('q') = key.code {
|
||||||
code: KeyCode::Char('z'),
|
return true;
|
||||||
modifiers: KeyModifiers::CONTROL,
|
|
||||||
..
|
|
||||||
}
|
}
|
||||||
)
|
}
|
||||||
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle_general_key_events1<V>(
|
fn handle_general_key_events1<V>(
|
||||||
|
Loading…
Reference in New Issue
Block a user