ignore ctrl+c in commit to allow quitting

This commit is contained in:
Stephan Dilly 2020-05-10 14:47:19 +02:00
parent 7e8e3a0bd5
commit c638eb0329

View file

@ -7,7 +7,7 @@ use crate::{
strings, ui,
};
use asyncgit::{sync, CWD};
use crossterm::event::{Event, KeyCode};
use crossterm::event::{Event, KeyCode, KeyModifiers};
use log::error;
use std::borrow::Cow;
use strings::commands;
@ -76,11 +76,17 @@ impl Component for CommitComponent {
fn event(&mut self, ev: Event) -> bool {
if self.visible {
if let Event::Key(e) = ev {
let has_ctrl =
e.modifiers.contains(KeyModifiers::CONTROL);
match e.code {
KeyCode::Esc => {
self.hide();
}
KeyCode::Char(c) => {
// ignore and early out on ctrl+c
if c == 'c' && has_ctrl {
return false;
}
self.msg.push(c);
}
KeyCode::Enter if self.can_commit() => {