Skip to content

Commit

Permalink
Added partial completions to the MenuNext event (#828)
Browse files Browse the repository at this point in the history
* Update values on MenuNext

* changed update values to partial completions
  • Loading branch information
uek-1 authored Sep 24, 2024
1 parent 4096b93 commit 660a507
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -965,17 +965,26 @@ 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.partial_completions {
menu.can_partially_complete(
self.quick_completions,
&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 660a507

Please sign in to comment.