Wrap command completion containing spaces, semicolons or quotes in double quotes

This commit is contained in:
Maxime Coste 2014-05-05 12:54:23 +01:00
parent 7f0e82dd81
commit 36620f8cc8

View File

@ -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: