feat: allow ctrl+c to exit application #46

Closed
kjuulh wants to merge 1 commits from push-moqzlwmmvpko into main
2 changed files with 8 additions and 1 deletions
Showing only changes of commit 383ef39cd7 - Show all commits

2
Cargo.lock generated
View File

@ -747,7 +747,7 @@ dependencies = [
[[package]]
name = "gitnow"
version = "0.2.3"
version = "0.3.0"
dependencies = [
"anyhow",
"async-trait",

View File

@ -36,6 +36,7 @@ impl InteractiveApp for &'static crate::app::App {
}
mod app {
use crossterm::event::KeyModifiers;
use ratatui::{
crossterm::event::{self, Event, KeyCode},
layout::{Constraint, Layout},
@ -92,6 +93,12 @@ mod app {
terminal.draw(|frame| self.draw(frame))?;
if let Event::Key(key) = event::read()? {
if let KeyCode::Char('c') = key.code {
if key.modifiers.contains(KeyModifiers::CONTROL) {
return Ok(None);
}
}
match key.code {
KeyCode::Char(letter) => {
self.current_search.push(letter);