From 3d283b2ca43bb077f52c48fec5e4870cd314b4e3 Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Thu, 3 Nov 2022 20:58:54 -0500 Subject: 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. --- helix-term/src/commands/typed.rs | 1 + 1 file changed, 1 insertion(+) (limited to 'helix-term/src/commands/typed.rs') diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs index 304b30f9..36080d39 100644 --- a/helix-term/src/commands/typed.rs +++ b/helix-term/src/commands/typed.rs @@ -2219,6 +2219,7 @@ pub(super) fn command_mode(cx: &mut Context) { completer(editor, part) .into_iter() .map(|(range, file)| { + let file = shellwords::escape(file); // offset ranges to input let offset = input.len() - part.len(); let range = (range.start + offset)..; -- cgit v1.2.3-70-g09d2