diff --git a/CHANGELOG.md b/CHANGELOG.md index 8627e0a3..a587d69f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ ## [Unreleased] -- No changes since the latest release below. +- Fix suggestions not updated after selecting current suggestion. ## [0.7.4] - 2024-03-25 diff --git a/inquire/examples/complex_autocompletion.rs b/inquire/examples/complex_autocompletion.rs index cdd9c8a0..38ea6bee 100644 --- a/inquire/examples/complex_autocompletion.rs +++ b/inquire/examples/complex_autocompletion.rs @@ -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(()); } diff --git a/inquire/src/prompts/text/prompt.rs b/inquire/src/prompts/text/prompt.rs index 1954a2e5..91d62122 100644 --- a/inquire/src/prompts/text/prompt.rs +++ b/inquire/src/prompts/text/prompt.rs @@ -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)