mirror of
https://github.com/ChrisTitusTech/linutil.git
synced 2024-12-23 20:09:44 +00:00
do not exit linutil in confirmation prompt when q is pressed (#758)
* do not exit linutil in confirmation prompt when q is pressed * remove cap support * add ``ctrl + c`` exiting Co-authored-by: Adam Perkowski <adas1per@protonmail.com> --------- Co-authored-by: nyx <nnyyxxxx@users.noreply.github.com> Co-authored-by: Adam Perkowski <adas1per@protonmail.com>
This commit is contained in:
parent
72dfb29969
commit
fc2d731754
|
@ -88,7 +88,7 @@ impl FloatContent for ConfirmPrompt {
|
|||
use KeyCode::*;
|
||||
self.status = match key.code {
|
||||
Char('y') | Char('Y') => ConfirmStatus::Confirm,
|
||||
Char('n') | Char('N') | Esc => ConfirmStatus::Abort,
|
||||
Char('n') | Char('N') | Esc | Char('q') => ConfirmStatus::Abort,
|
||||
Char('j') => {
|
||||
self.scroll_down();
|
||||
ConfirmStatus::None
|
||||
|
@ -116,10 +116,10 @@ impl FloatContent for ConfirmPrompt {
|
|||
"Confirmation prompt",
|
||||
Box::new([
|
||||
Shortcut::new("Continue", ["Y", "y"]),
|
||||
Shortcut::new("Abort", ["N", "n"]),
|
||||
Shortcut::new("Scroll up", ["j"]),
|
||||
Shortcut::new("Scroll down", ["k"]),
|
||||
Shortcut::new("Close linutil", ["CTRL-c", "q"]),
|
||||
Shortcut::new("Abort", ["N", "n", "q", "Esc"]),
|
||||
Shortcut::new("Scroll up", ["k"]),
|
||||
Shortcut::new("Scroll down", ["j"]),
|
||||
Shortcut::new("Close linutil", ["CTRL-c"]),
|
||||
]),
|
||||
)
|
||||
}
|
||||
|
|
|
@ -420,11 +420,15 @@ impl AppState {
|
|||
// This should be defined first to allow closing
|
||||
// the application even when not drawable ( If terminal is small )
|
||||
// Exit on 'q' or 'Ctrl-c' input
|
||||
if matches!(
|
||||
self.focus,
|
||||
Focus::TabList | Focus::List | Focus::ConfirmationPrompt(_)
|
||||
) && (key.code == KeyCode::Char('q')
|
||||
|| key.modifiers.contains(KeyModifiers::CONTROL) && key.code == KeyCode::Char('c'))
|
||||
if matches!(self.focus, Focus::TabList | Focus::List)
|
||||
&& (key.code == KeyCode::Char('q')
|
||||
|| key.modifiers.contains(KeyModifiers::CONTROL) && key.code == KeyCode::Char('c'))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if matches!(self.focus, Focus::ConfirmationPrompt(_))
|
||||
&& (key.modifiers.contains(KeyModifiers::CONTROL) && key.code == KeyCode::Char('c'))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user