mirror of
https://github.com/extrawurst/gitui.git
synced 2024-12-27 11:03:03 +03:00
quit key binding (closes #771)
This commit is contained in:
parent
aee872113b
commit
8d6a75babe
@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
## Added
|
## Added
|
||||||
- new `undo-last-commit` command [[@remique](https://github.com/remique)] ([#758](https://github.com/extrawurst/gitui/issues/758))
|
- new `undo-last-commit` command [[@remique](https://github.com/remique)] ([#758](https://github.com/extrawurst/gitui/issues/758))
|
||||||
- taglist: show arrow-symbol on tags not present on origin [[@cruessler](https://github.com/cruessler)] ([#776](https://github.com/extrawurst/gitui/issues/776))
|
- taglist: show arrow-symbol on tags not present on origin [[@cruessler](https://github.com/cruessler)] ([#776](https://github.com/extrawurst/gitui/issues/776))
|
||||||
|
- new quit key `[q]` ([#771](https://github.com/extrawurst/gitui/issues/771))
|
||||||
|
|
||||||
## Fixed
|
## Fixed
|
||||||
- openssl vendoring broken on macos ([#772](https://github.com/extrawurst/gitui/issues/772))
|
- openssl vendoring broken on macos ([#772](https://github.com/extrawurst/gitui/issues/772))
|
||||||
|
11
src/app.rs
11
src/app.rs
@ -261,8 +261,7 @@ impl App {
|
|||||||
log::trace!("event: {:?}", ev);
|
log::trace!("event: {:?}", ev);
|
||||||
|
|
||||||
if let InputEvent::Input(ev) = ev {
|
if let InputEvent::Input(ev) = ev {
|
||||||
if self.check_quit_key(ev) || self.check_weak_quit_key(ev)
|
if self.check_hard_exit(ev) || self.check_quit(ev) {
|
||||||
{
|
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -453,14 +452,12 @@ impl App {
|
|||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
fn check_weak_quit_key(&mut self, ev: Event) -> bool {
|
fn check_quit(&mut self, ev: Event) -> bool {
|
||||||
if self.any_popup_visible() {
|
if self.any_popup_visible() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if let Event::Key(e) = ev {
|
if let Event::Key(e) = ev {
|
||||||
if e == self.key_config.exit_if_no_popup
|
if e == self.key_config.quit {
|
||||||
|| e == self.key_config.exit_popup
|
|
||||||
{
|
|
||||||
self.do_quit = true;
|
self.do_quit = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -468,7 +465,7 @@ impl App {
|
|||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
fn check_quit_key(&mut self, ev: Event) -> bool {
|
fn check_hard_exit(&mut self, ev: Event) -> bool {
|
||||||
if let Event::Key(e) = ev {
|
if let Event::Key(e) = ev {
|
||||||
if e == self.key_config.exit {
|
if e == self.key_config.exit {
|
||||||
self.do_quit = true;
|
self.do_quit = true;
|
||||||
|
@ -34,7 +34,7 @@ pub struct KeyConfig {
|
|||||||
pub focus_above: KeyEvent,
|
pub focus_above: KeyEvent,
|
||||||
pub focus_below: KeyEvent,
|
pub focus_below: KeyEvent,
|
||||||
pub exit: KeyEvent,
|
pub exit: KeyEvent,
|
||||||
pub exit_if_no_popup: KeyEvent,
|
pub quit: KeyEvent,
|
||||||
pub exit_popup: KeyEvent,
|
pub exit_popup: KeyEvent,
|
||||||
pub open_commit: KeyEvent,
|
pub open_commit: KeyEvent,
|
||||||
pub open_commit_editor: KeyEvent,
|
pub open_commit_editor: KeyEvent,
|
||||||
@ -102,7 +102,7 @@ impl Default for KeyConfig {
|
|||||||
focus_above: KeyEvent { code: KeyCode::Up, modifiers: KeyModifiers::empty()},
|
focus_above: KeyEvent { code: KeyCode::Up, modifiers: KeyModifiers::empty()},
|
||||||
focus_below: KeyEvent { code: KeyCode::Down, modifiers: KeyModifiers::empty()},
|
focus_below: KeyEvent { code: KeyCode::Down, modifiers: KeyModifiers::empty()},
|
||||||
exit: KeyEvent { code: KeyCode::Char('c'), modifiers: KeyModifiers::CONTROL},
|
exit: KeyEvent { code: KeyCode::Char('c'), modifiers: KeyModifiers::CONTROL},
|
||||||
exit_if_no_popup: KeyEvent { code: KeyCode::Char('q'), modifiers: KeyModifiers::empty()},
|
quit: KeyEvent { code: KeyCode::Char('q'), modifiers: KeyModifiers::empty()},
|
||||||
exit_popup: KeyEvent { code: KeyCode::Esc, modifiers: KeyModifiers::empty()},
|
exit_popup: KeyEvent { code: KeyCode::Esc, modifiers: KeyModifiers::empty()},
|
||||||
open_commit: KeyEvent { code: KeyCode::Char('c'), modifiers: KeyModifiers::empty()},
|
open_commit: KeyEvent { code: KeyCode::Char('c'), modifiers: KeyModifiers::empty()},
|
||||||
open_commit_editor: KeyEvent { code: KeyCode::Char('e'), modifiers:KeyModifiers::CONTROL},
|
open_commit_editor: KeyEvent { code: KeyCode::Char('e'), modifiers:KeyModifiers::CONTROL},
|
||||||
|
Loading…
Reference in New Issue
Block a user