diff options
author | Michael Davis | 2022-11-04 01:58:54 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2022-11-07 04:38:16 +0000 |
commit | 3d283b2ca43bb077f52c48fec5e4870cd314b4e3 (patch) | |
tree | c95f608404ce5da069688eb0ccf9d196cadbcc31 /helix-term/src/ui | |
parent | 1536a6528968f38adfac2e991b29006f5ded5968 (diff) |
Escape filenames in command completion
This changes the completion items to be rendered with shellword
escaping, so a file `a b.txt` is rendered as `a\ b.txt` which matches
how it should be inputted.
Diffstat (limited to 'helix-term/src/ui')
-rw-r--r-- | helix-term/src/ui/prompt.rs | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/helix-term/src/ui/prompt.rs b/helix-term/src/ui/prompt.rs index ca2872a7..51ef688d 100644 --- a/helix-term/src/ui/prompt.rs +++ b/helix-term/src/ui/prompt.rs @@ -1,6 +1,5 @@ use crate::compositor::{Component, Compositor, Context, Event, EventResult}; use crate::{alt, ctrl, key, shift, ui}; -use helix_core::shellwords; use helix_view::input::KeyEvent; use helix_view::keyboard::KeyCode; use std::{borrow::Cow, ops::RangeFrom}; @@ -336,10 +335,7 @@ impl Prompt { let (range, item) = &self.completion[index]; - // since we are using shellwords to parse arguments, make sure - // that whitespace in files is properly escaped. - let item = shellwords::escape(item); - self.line.replace_range(range.clone(), &item); + self.line.replace_range(range.clone(), item); self.move_end(); } |