Unnamed repository; edit this file 'description' to name the repository.
-rw-r--r--helix-term/src/ui/picker.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/helix-term/src/ui/picker.rs b/helix-term/src/ui/picker.rs
index 3986ad47..a6ce91a6 100644
--- a/helix-term/src/ui/picker.rs
+++ b/helix-term/src/ui/picker.rs
@@ -1079,7 +1079,15 @@ impl<I: 'static + Send + Sync, D: 'static + Send + Sync> Component for Picker<I,
.first_history_completion(ctx.editor)
.filter(|_| self.prompt.line().is_empty())
{
- self.prompt.set_line(completion.to_string(), ctx.editor);
+ // The percent character is used by the query language and needs to be
+ // escaped with a backslash.
+ let completion = if completion.contains('%') {
+ completion.replace('%', "\\%")
+ } else {
+ completion.into_owned()
+ };
+ self.prompt.set_line(completion, ctx.editor);
+
// Inserting from the history register is a paste.
self.handle_prompt_change(true);
} else {