Lines
94.44 %
Functions
50 %
Branches
100 %
//! The open menu: moves the selection, applies the chosen entry, closes.
use super::{Intent, apply};
use crate::app::App;
pub(super) fn handle(app: &mut App, intent: Intent) {
match intent {
Intent::CloseMenu => app.close_menu(),
Intent::MenuNext => app.menu_next(),
Intent::MenuPrev => app.menu_prev(),
Intent::MenuFirst => app.menu_first(),
Intent::MenuLast => app.menu_last(),
Intent::MenuLeft => app.menu_left(),
Intent::MenuRight => app.menu_right(),
Intent::MenuSelect => select(app),
_ => {}
}
/// Closes the menu, then applies the chosen entry as its key would; a disabled one does nothing.
fn select(app: &mut App) {
if let Some(intent) = app.menu_choice() {
app.close_menu();
apply(app, intent);