diff --git a/src/engine.rs b/src/engine.rs index c87afac8..fdddc895 100644 --- a/src/engine.rs +++ b/src/engine.rs @@ -967,6 +967,14 @@ impl Reedline { return Ok(EventStatus::Handled); } + if self.quick_completions + && menu.can_quick_complete() + && menu.get_values().is_empty() + { + menu.menu_event(MenuEvent::Deactivate); + return Ok(EventStatus::Inapplicable); + } + return Ok(EventStatus::Handled); } } @@ -975,6 +983,9 @@ impl Reedline { ReedlineEvent::MenuNext => { self.active_menu() .map_or(Ok(EventStatus::Inapplicable), |menu| { + if menu.get_values().len() < 2 { + return Ok(EventStatus::Inapplicable); + } menu.menu_event(MenuEvent::NextElement); Ok(EventStatus::Handled) }) @@ -982,6 +993,9 @@ impl Reedline { ReedlineEvent::MenuPrevious => { self.active_menu() .map_or(Ok(EventStatus::Inapplicable), |menu| { + if menu.get_values().len() < 2 { + return Ok(EventStatus::Inapplicable); + } menu.menu_event(MenuEvent::PreviousElement); Ok(EventStatus::Handled) }) @@ -989,6 +1003,9 @@ impl Reedline { ReedlineEvent::MenuUp => { self.active_menu() .map_or(Ok(EventStatus::Inapplicable), |menu| { + if menu.get_values().len() < 2 { + return Ok(EventStatus::Inapplicable); + } menu.menu_event(MenuEvent::MoveUp); Ok(EventStatus::Handled) }) @@ -996,6 +1013,9 @@ impl Reedline { ReedlineEvent::MenuDown => { self.active_menu() .map_or(Ok(EventStatus::Inapplicable), |menu| { + if menu.get_values().len() < 2 { + return Ok(EventStatus::Inapplicable); + } menu.menu_event(MenuEvent::MoveDown); Ok(EventStatus::Handled) }) @@ -1003,6 +1023,9 @@ impl Reedline { ReedlineEvent::MenuLeft => { self.active_menu() .map_or(Ok(EventStatus::Inapplicable), |menu| { + if menu.get_values().len() < 2 { + return Ok(EventStatus::Inapplicable); + } menu.menu_event(MenuEvent::MoveLeft); Ok(EventStatus::Handled) }) @@ -1010,6 +1033,9 @@ impl Reedline { ReedlineEvent::MenuRight => { self.active_menu() .map_or(Ok(EventStatus::Inapplicable), |menu| { + if menu.get_values().len() < 2 { + return Ok(EventStatus::Inapplicable); + } menu.menu_event(MenuEvent::MoveRight); Ok(EventStatus::Handled) })