diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2014-05-05 12:54:23 +0100 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2014-05-05 12:54:23 +0100 |
| commit | 36620f8cc8bd90efda4671d401286de63c233363 (patch) | |
| tree | 01cdfd39a06bae79f8fd5a28fd8016be44e24db0 /src/command_manager.cc | |
| parent | 7f0e82dd81abf7afbaa80cc26b71e0a602744289 (diff) | |
Wrap command completion containing spaces, semicolons or quotes in double quotes
Diffstat (limited to 'src/command_manager.cc')
| -rw-r--r-- | src/command_manager.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/command_manager.cc b/src/command_manager.cc index 26b2379f..6e61d55d 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: |
