From c42a421828718852d0a9671f5ec9b30d1641e31c Mon Sep 17 00:00:00 2001 From: Stephan Dilly Date: Sun, 10 May 2020 14:51:31 +0200 Subject: [PATCH] allow quitting (ctrl+c) everywhere --- src/app.rs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/app.rs b/src/app.rs index 3b08d002..baaa78c7 100644 --- a/src/app.rs +++ b/src/app.rs @@ -172,10 +172,6 @@ impl App { flags.insert(NeedsUpdate::COMMANDS); } else if let Event::Key(k) = ev { let new_flags = match k { - keys::EXIT => { - self.do_quit = true; - NeedsUpdate::empty() - } keys::FOCUS_WORKDIR => { self.switch_focus(Focus::WorkDir) } @@ -206,6 +202,8 @@ impl App { flags.insert(new_flags); } + self.check_quit(ev); + let new_flags = self.process_queue(); flags.insert(new_flags); @@ -298,6 +296,17 @@ impl App { None } + fn check_quit(&mut self, ev: Event) { + if let Event::Key(e) = ev { + match e { + keys::EXIT => { + self.do_quit = true; + } + _ => (), + } + } + } + fn toggle_tabs(&mut self) { self.tab += 1; self.tab %= 2;