From 398ea88680f2c3a565db887f5ed42a5299ae1e3d Mon Sep 17 00:00:00 2001 From: Mikael Mello Date: Sun, 29 Sep 2024 16:00:21 -0700 Subject: [PATCH] Fix autocomplete suggestions not being updated after a suggestion is accepted MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Ilia Co-authored-by: Moritz Hölting --- CHANGELOG.md | 1 + inquire/src/prompts/text/prompt.rs | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6748ccd2..d2f0d5d7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ## [Unreleased] +- Fix autocomplete suggestions not being updated after a suggestion is accepted. Thanks @moritz-hoelting and @istudyatuni for reporting and fixing it! - Fix incorrect cursor placement when inputting CJK characters. Thanks @phostann (#270) for reporting it! - Removed unused dependency (newline-converter). Thanks @jonassmedegaard (#267) for catching it! diff --git a/inquire/src/prompts/text/prompt.rs b/inquire/src/prompts/text/prompt.rs index 1954a2e5..e0ae7ab9 100644 --- a/inquire/src/prompts/text/prompt.rs +++ b/inquire/src/prompts/text/prompt.rs @@ -214,7 +214,15 @@ 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()?; + + if let ActionResult::NeedsRedraw = result { + self.update_suggestions()?; + } + + result + } }; Ok(result)