From 8791f7463c917603e86dc15ec5deda2afb38bbf4 Mon Sep 17 00:00:00 2001 From: Vivek Kethineni Date: Mon, 16 Sep 2024 19:41:37 -0500 Subject: [PATCH] Update values on MenuNext --- src/engine.rs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/engine.rs b/src/engine.rs index 3c4fa2a0..915ea09d 100644 --- a/src/engine.rs +++ b/src/engine.rs @@ -965,17 +965,25 @@ impl Reedline { } Ok(EventStatus::Inapplicable) } - ReedlineEvent::MenuNext => match self.active_menu() { - None => Ok(EventStatus::Inapplicable), - Some(menu) => { + ReedlineEvent::MenuNext => { + if let Some(menu) = self.menus.iter_mut().find(|menu| menu.is_active()) { + if self.quick_completions && menu.can_quick_complete() { + menu.update_values( + &mut self.editor, + self.completer.as_mut(), + self.history.as_ref(), + ); + }; if menu.get_values().len() == 1 && menu.can_quick_complete() { self.handle_editor_event(prompt, ReedlineEvent::Enter) } else { menu.menu_event(MenuEvent::NextElement); Ok(EventStatus::Handled) } + } else { + Ok(EventStatus::Inapplicable) } - }, + } ReedlineEvent::MenuPrevious => { self.active_menu() .map_or(Ok(EventStatus::Inapplicable), |menu| {