Skip to content

Commit f85af1c

Browse files
authored
Merge pull request #8 from fadeevab/feature/esc
Support `Esc` and `Q` for exiting
2 parents 0658c5f + 140c62b commit f85af1c

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/app.rs

+6-5
Original file line numberDiff line numberDiff line change
@@ -329,9 +329,9 @@ impl App {
329329
let backend = CrosstermBackend::new(stdout);
330330
let terminal = Terminal::new(backend)?;
331331
let state = State::new(
332-
terminal.size()?,
333-
args.mode,
334-
args.level as u64,
332+
terminal.size()?,
333+
args.mode,
334+
args.level as u64,
335335
args.timer_color);
336336

337337
Ok(Self {
@@ -370,8 +370,9 @@ impl App {
370370
}
371371

372372
fn handle_keyboard(&mut self, key: KeyEvent) {
373-
if let KeyCode::Char('q') = key.code {
374-
self.should_quit = true;
373+
match key.code {
374+
KeyCode::Esc | KeyCode::Char('q') | KeyCode::Char('Q') => self.should_quit = true,
375+
_ => {}
375376
}
376377
}
377378
}

0 commit comments

Comments
 (0)