Skip to content

Commit

Permalink
Merge remote-tracking branch 'alec/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcph4 committed Jan 20, 2025
2 parents 62f5d37 + 2a94b71 commit 04b5260
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/ui/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ impl App {
}
}

pub fn on_quit(&mut self) {
self.should_quit = true
}

pub fn on_esc(&mut self) {
match self.view {
View::Default => self.should_quit = true,
Expand Down
7 changes: 6 additions & 1 deletion src/ui/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::time::{Duration, Instant};

use app::App;
use crossterm::event::{self, Event, KeyCode};
use crossterm::event::{self, Event, KeyCode, KeyModifiers};
use ratatui::DefaultTerminal;

use crate::db::Database;
Expand Down Expand Up @@ -39,6 +39,11 @@ pub fn run(mut terminal: DefaultTerminal, db: &Database) -> eyre::Result<()> {
KeyCode::Down | KeyCode::Char('j') => app.on_down(),
KeyCode::Enter => app.on_enter(),
KeyCode::Esc => app.on_esc(),
KeyCode::Char('c')
if key.modifiers.contains(KeyModifiers::CONTROL) =>
{
app.on_quit()
}
KeyCode::Char(c) => app.on_key(c),
_ => {}
}
Expand Down

0 comments on commit 04b5260

Please sign in to comment.