From aee872113b9e7c12d69c63fe2053d15ab8470268 Mon Sep 17 00:00:00 2001 From: Levi Olorenshaw Date: Thu, 24 Jun 2021 10:46:53 +1000 Subject: [PATCH] run rustfmt and fix vim style key config test failure --- src/app.rs | 14 +++++++++----- vim_style_key_config.ron | 1 + 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/app.rs b/src/app.rs index b98f0183..659de896 100644 --- a/src/app.rs +++ b/src/app.rs @@ -261,7 +261,8 @@ impl App { log::trace!("event: {:?}", ev); if let InputEvent::Input(ev) = ev { - if self.check_quit_key(ev) || self.check_weak_quit_key(ev) { + if self.check_quit_key(ev) || self.check_weak_quit_key(ev) + { return Ok(()); } @@ -451,12 +452,15 @@ impl App { msg ] ); - + fn check_weak_quit_key(&mut self, ev: Event) -> bool { - if self.any_popup_visible() { return false } + if self.any_popup_visible() { + return false; + } if let Event::Key(e) = ev { - if e == self.key_config.exit_if_no_popup || - e == self.key_config.exit_popup { + if e == self.key_config.exit_if_no_popup + || e == self.key_config.exit_popup + { self.do_quit = true; return true; } diff --git a/vim_style_key_config.ron b/vim_style_key_config.ron index 8fc15759..1825c805 100644 --- a/vim_style_key_config.ron +++ b/vim_style_key_config.ron @@ -27,6 +27,7 @@ open_help: ( code: F(1), modifiers: ( bits: 0,),), exit: ( code: Char('Q'), modifiers: ( bits: 1,),), + exit_if_no_popup: ( code: Char('q'), modifiers: ( bits: 0,),), exit_popup: ( code: Esc, modifiers: ( bits: 0,),), open_commit: ( code: Char('c'), modifiers: ( bits: 0,),),