Skip to content

Commit

Permalink
allow quitting (ctrl+c) everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephan Dilly committed May 10, 2020
1 parent c638eb0 commit c42a421
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -206,6 +202,8 @@ impl App {
flags.insert(new_flags);
}

self.check_quit(ev);

let new_flags = self.process_queue();
flags.insert(new_flags);

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit c42a421

Please sign in to comment.