feat: allow ctrl+c to exit application
This commit is contained in:
parent
708180f9a2
commit
ada020e283
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -748,6 +748,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "gitnow"
|
name = "gitnow"
|
||||||
version = "0.3.1"
|
version = "0.3.1"
|
||||||
|
version = "0.2.3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"async-trait",
|
"async-trait",
|
||||||
|
@ -36,6 +36,7 @@ impl InteractiveApp for &'static crate::app::App {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mod app {
|
mod app {
|
||||||
|
use crossterm::event::KeyModifiers;
|
||||||
use ratatui::{
|
use ratatui::{
|
||||||
crossterm::event::{self, Event, KeyCode},
|
crossterm::event::{self, Event, KeyCode},
|
||||||
layout::{Constraint, Layout},
|
layout::{Constraint, Layout},
|
||||||
@ -92,6 +93,12 @@ mod app {
|
|||||||
terminal.draw(|frame| self.draw(frame))?;
|
terminal.draw(|frame| self.draw(frame))?;
|
||||||
|
|
||||||
if let Event::Key(key) = event::read()? {
|
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 {
|
match key.code {
|
||||||
KeyCode::Char(letter) => {
|
KeyCode::Char(letter) => {
|
||||||
self.current_search.push(letter);
|
self.current_search.push(letter);
|
||||||
|
Loading…
Reference in New Issue
Block a user