Skip to content

Commit

Permalink
Earlier check for C-c
Browse files Browse the repository at this point in the history
  • Loading branch information
TheRealLorenz committed Jan 16, 2024
1 parent 4c7f44b commit 13fc801
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions rq-cli/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,13 @@ impl App {
}

async fn on_key_event(&mut self, event: KeyEvent) -> anyhow::Result<()> {
if let KeyCode::Char('c') = event.code {
if event.modifiers == KeyModifiers::CONTROL {
self.should_exit = true;
return Ok(());
}
}

if let Some(popup) = self.popups.front_mut() {
match popup.on_event(event)? {
HandleSuccess::Consumed => {
Expand All @@ -107,16 +114,8 @@ impl App {
Err(e) => return Err(e),
};

match event.code {
KeyCode::Char('q' | 'Q') => {
self.should_exit = true;
}
KeyCode::Char('c') => {
if event.modifiers == KeyModifiers::CONTROL {
self.should_exit = true;
}
}
_ => (),
if let KeyCode::Char('q' | 'Q') = event.code {
self.should_exit = true;
};

Ok(())
Expand Down

0 comments on commit 13fc801

Please sign in to comment.