Skip to content

Commit

Permalink
Update values on MenuNext
Browse files Browse the repository at this point in the history
  • Loading branch information
uek-1 committed Sep 17, 2024
1 parent b20afdc commit 8791f74
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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| {
Expand Down

0 comments on commit 8791f74

Please sign in to comment.