Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Close left menu on back/quit action #55

Merged
merged 1 commit into from
Apr 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading