diff options
| author | Tamas Berghammer <tberghammer@google.com> | 2015-09-02 10:35:27 +0000 |
|---|---|---|
| committer | Tamas Berghammer <tberghammer@google.com> | 2015-09-02 10:35:27 +0000 |
| commit | 89d3f090b2cb81fd26d595b2c97439466822fe17 (patch) | |
| tree | c095aeac1f343ffd9f67411acd5f5bba636f2410 /lldb/source/Interpreter/CommandInterpreter.cpp | |
| parent | e6035de11ea24b55481886880da400e9e810f599 (diff) | |
| download | llvm-89d3f090b2cb81fd26d595b2c97439466822fe17.zip llvm-89d3f090b2cb81fd26d595b2c97439466822fe17.tar.gz llvm-89d3f090b2cb81fd26d595b2c97439466822fe17.tar.bz2 | |
Fix tab completion for command arguments containing spaces
If a command argument contains a space then it have to be escaped with
backslash signs so the argument parsing logic can parse it properly.
This CL fixes the tab completion code for the arguments to create
complitions with correctly escaped strings.
Differential revision: http://reviews.llvm.org/D12531
llvm-svn: 246639
Diffstat (limited to 'lldb/source/Interpreter/CommandInterpreter.cpp')
| -rw-r--r-- | lldb/source/Interpreter/CommandInterpreter.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp index 1147d13..fa1c8af 100644 --- a/lldb/source/Interpreter/CommandInterpreter.cpp +++ b/lldb/source/Interpreter/CommandInterpreter.cpp @@ -2002,7 +2002,7 @@ CommandInterpreter::HandleCompletion (const char *current_line, matches); if (num_command_matches <= 0) - return num_command_matches; + return num_command_matches; if (num_args == 0) { @@ -2021,18 +2021,18 @@ CommandInterpreter::HandleCompletion (const char *current_line, std::string common_prefix; matches.LongestCommonPrefix (common_prefix); const size_t partial_name_len = command_partial_str.size(); + common_prefix.erase (0, partial_name_len); // If we matched a unique single command, add a space... // Only do this if the completer told us this was a complete word, however... if (num_command_matches == 1 && word_complete) { char quote_char = parsed_line.GetArgumentQuoteCharAtIndex(cursor_index); + common_prefix = Args::EscapeLLDBCommandArgument(common_prefix, quote_char); if (quote_char != '\0') common_prefix.push_back(quote_char); - common_prefix.push_back(' '); } - common_prefix.erase (0, partial_name_len); matches.InsertStringAtIndex(0, common_prefix.c_str()); } return num_command_matches; |
