Skip to content

Commit

Permalink
fix: update suggestions list after selecting suggestion from list
Browse files Browse the repository at this point in the history
  • Loading branch information
istudyatuni committed Apr 14, 2024
1 parent 7fe8e5e commit e107f3a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

## [Unreleased] <!-- ReleaseDate -->

- No changes since the latest release below.
- Fix suggestions not updated after selecting current suggestion.

## [0.7.4] - 2024-03-25

Expand Down
2 changes: 1 addition & 1 deletion inquire/examples/complex_autocompletion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pub struct FilePathCompleter {

impl FilePathCompleter {
fn update_input(&mut self, input: &str) -> Result<(), CustomUserError> {
if input == self.input {
if !input.is_empty() && input == self.input {
return Ok(());
}

Expand Down
6 changes: 5 additions & 1 deletion inquire/src/prompts/text/prompt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,11 @@ where
TextPromptAction::MoveToSuggestionPageDown => {
self.move_cursor_down(self.config.page_size)
}
TextPromptAction::UseCurrentSuggestion => self.use_current_suggestion()?,
TextPromptAction::UseCurrentSuggestion => {
let result = self.use_current_suggestion()?;
self.update_suggestions()?;
result
}
};

Ok(result)
Expand Down

0 comments on commit e107f3a

Please sign in to comment.