Clear screen when hiding menubar

Otherwise it's visible but inactive
This commit is contained in:
Alexandre Bury 2016-07-16 01:07:37 -07:00
parent 2b54d6df28
commit 99993ab1ec

View File

@ -1,5 +1,6 @@
use Cursive; use Cursive;
use menu::MenuTree; use menu::MenuTree;
use backend::Backend;
use view::MenuPopup; use view::MenuPopup;
use view::KeyEventView; use view::KeyEventView;
use theme::ColorStyle; 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) { pub fn take_focus(&mut self) {
self.state = State::Selected; self.state = State::Selected;
} }
@ -88,7 +94,7 @@ impl Menubar {
pub fn on_event(&mut self, event: Event) -> Option<Callback> { pub fn on_event(&mut self, event: Event) -> Option<Callback> {
match event { match event {
Event::Key(Key::Esc) => self.state = State::Inactive, Event::Key(Key::Esc) => self.hide(),
Event::Key(Key::Left) => { Event::Key(Key::Left) => {
if self.focus > 0 { if self.focus > 0 {
self.focus -= 1 self.focus -= 1