Skip to content

Commit

Permalink
Close left menu on back/quit action
Browse files Browse the repository at this point in the history
Fixes: #50
  • Loading branch information
azat committed Apr 4, 2024
1 parent 41a8b40 commit 5f6d964
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/view/navigation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,22 @@ impl Navigation for Cursive {
}

fn pop_ui(&mut self, exit: bool) {
// Close left menu
let mut has_left_menu = false;
self.call_on_name("left_menu", |left_menu_view: &mut LinearLayout| {
if !left_menu_view.is_empty() {
left_menu_view
.remove_child(left_menu_view.len() - 1)
.expect("No child view to remove");
has_left_menu = true;
}
});
// Once at a time
if has_left_menu {
self.focus_name("main").unwrap();
return;
}

// - main view
// - statusbar
if self.screen_mut().len() == 2 {
Expand Down

0 comments on commit 5f6d964

Please sign in to comment.