From 36620f8cc8bd90efda4671d401286de63c233363 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Mon, 5 May 2014 12:54:23 +0100 Subject: [PATCH] Wrap command completion containing spaces, semicolons or quotes in double quotes --- src/command_manager.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/command_manager.cc b/src/command_manager.cc index 26b2379f5..6e61d55db 100644 --- a/src/command_manager.cc +++ b/src/command_manager.cc @@ -545,6 +545,13 @@ Completions CommandManager::complete(const Context& context, cursor_pos_in_token); completions.start += start; completions.end += start; + + for (auto& candidate : completions.candidates) + { + if (candidate.find_first_of(" \t;\"'") != String::npos) + candidate = '"' + escape(candidate, '"', '\\') + '"'; + } + return completions; } default: