From 5d30eb65f91bc5a6ef501cb7c4e2d242762a02ea Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Tue, 4 Jun 2019 16:47:20 +0530 Subject: [PATCH] Don't quit hard when hitting 'q' --- src/interactive/app.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/interactive/app.rs b/src/interactive/app.rs index 3d7b3420..91d20222 100644 --- a/src/interactive/app.rs +++ b/src/interactive/app.rs @@ -116,13 +116,13 @@ impl TerminalApp { R: io::Read + TermReadEventsAndRaw, { use termion::event::Key::{Char, Ctrl}; + use FocussedPane::*; self.draw(terminal)?; for key in keys.filter_map(Result::ok) { self.update_message(); match key { Char('?') => { - use FocussedPane::*; self.state.focussed = match self.state.focussed { Main => { self.state.help_pane = Some(HelpPaneState); @@ -134,7 +134,14 @@ impl TerminalApp { } } } - Ctrl('c') | Char('q') => break, + Ctrl('c') => break, + Char('q') => match self.state.focussed { + Main => break, + Help => { + self.state.focussed = Main; + self.state.help_pane = None + } + }, _ => {} }