Skip to content

Commit c638eb0

Browse files
author
Stephan Dilly
committed
ignore ctrl+c in commit to allow quitting
1 parent 7e8e3a0 commit c638eb0

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/components/commit.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use crate::{
77
strings, ui,
88
};
99
use asyncgit::{sync, CWD};
10-
use crossterm::event::{Event, KeyCode};
10+
use crossterm::event::{Event, KeyCode, KeyModifiers};
1111
use log::error;
1212
use std::borrow::Cow;
1313
use strings::commands;
@@ -76,11 +76,17 @@ impl Component for CommitComponent {
7676
fn event(&mut self, ev: Event) -> bool {
7777
if self.visible {
7878
if let Event::Key(e) = ev {
79+
let has_ctrl =
80+
e.modifiers.contains(KeyModifiers::CONTROL);
7981
match e.code {
8082
KeyCode::Esc => {
8183
self.hide();
8284
}
8385
KeyCode::Char(c) => {
86+
// ignore and early out on ctrl+c
87+
if c == 'c' && has_ctrl {
88+
return false;
89+
}
8490
self.msg.push(c);
8591
}
8692
KeyCode::Enter if self.can_commit() => {

0 commit comments

Comments
 (0)