Fix quick completion (#732)

This commit is contained in:
nibon7 2024-01-30 03:07:27 +08:00 committed by GitHub
parent 090af4d323
commit a5d3c353ec
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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| {