From 99993ab1ec7cdd6303dff2eca46465475f6b3793 Mon Sep 17 00:00:00 2001 From: Alexandre Bury Date: Sat, 16 Jul 2016 01:07:37 -0700 Subject: [PATCH] Clear screen when hiding menubar Otherwise it's visible but inactive --- src/menubar.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/menubar.rs b/src/menubar.rs index 13beaa9..e442920 100644 --- a/src/menubar.rs +++ b/src/menubar.rs @@ -1,5 +1,6 @@ use Cursive; use menu::MenuTree; +use backend::Backend; use view::MenuPopup; use view::KeyEventView; use theme::ColorStyle; @@ -49,6 +50,11 @@ impl Menubar { } } + fn hide(&mut self) { + self.state = State::Inactive; + ::B::clear(); + } + pub fn take_focus(&mut self) { self.state = State::Selected; } @@ -88,7 +94,7 @@ impl Menubar { pub fn on_event(&mut self, event: Event) -> Option { match event { - Event::Key(Key::Esc) => self.state = State::Inactive, + Event::Key(Key::Esc) => self.hide(), Event::Key(Key::Left) => { if self.focus > 0 { self.focus -= 1