From a5d3c353ec9c2b74012e8f6d154ffd09525ee1c5 Mon Sep 17 00:00:00 2001 From: nibon7 Date: Tue, 30 Jan 2024 03:07:27 +0800 Subject: [PATCH] Fix quick completion (#732) --- src/engine.rs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/engine.rs b/src/engine.rs index 50f57acb..e7bcceb7 100644 --- a/src/engine.rs +++ b/src/engine.rs @@ -937,13 +937,17 @@ impl Reedline { } Ok(EventStatus::Inapplicable) } - ReedlineEvent::MenuNext => { - self.active_menu() - .map_or(Ok(EventStatus::Inapplicable), |menu| { + ReedlineEvent::MenuNext => match self.active_menu() { + None => Ok(EventStatus::Inapplicable), + Some(menu) => { + 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) - }) - } + } + } + }, ReedlineEvent::MenuPrevious => { self.active_menu() .map_or(Ok(EventStatus::Inapplicable), |menu| {