diff options
author | Jim Ingham <jingham@apple.com> | 2010-12-14 19:56:01 +0000 |
---|---|---|
committer | Jim Ingham <jingham@apple.com> | 2010-12-14 19:56:01 +0000 |
commit | fe0c42530858a987de04962e940e8ca614afd802 (patch) | |
tree | d88a64ccc1792b3e6249ec930b3c69d22823580e /lldb/source/Interpreter/CommandInterpreter.cpp | |
parent | f636a64bfe6f0f0bab6116ff01f1ee8e71663113 (diff) | |
download | bcm5719-llvm-fe0c42530858a987de04962e940e8ca614afd802.tar.gz bcm5719-llvm-fe0c42530858a987de04962e940e8ca614afd802.zip |
Fix the completion of "fr " and the like.
llvm-svn: 121785
Diffstat (limited to 'lldb/source/Interpreter/CommandInterpreter.cpp')
-rw-r--r-- | lldb/source/Interpreter/CommandInterpreter.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp index 8c4c884f0c8..4a0fe997767 100644 --- a/lldb/source/Interpreter/CommandInterpreter.cpp +++ b/lldb/source/Interpreter/CommandInterpreter.cpp @@ -1007,6 +1007,23 @@ CommandInterpreter::HandleCompletion (const char *current_line, cursor_char_position = 0; else cursor_char_position = strlen (partial_parsed_line.GetArgumentAtIndex(cursor_index)); + + if (cursor > current_line && cursor[-1] == ' ') + { + // We are just after a space. If we are in an argument, then we will continue + // parsing, but if we are between arguments, then we have to complete whatever the next + // element would be. + // We can distinguish the two cases because if we are in an argument (e.g. because the space is + // protected by a quote) then the space will also be in the parsed argument... + + const char *current_elem = partial_parsed_line.GetArgumentAtIndex(cursor_index); + if (cursor_char_position == 0 || current_elem[cursor_char_position - 1] != ' ') + { + parsed_line.InsertArgumentAtIndex(cursor_index + 1, "", '"'); + cursor_index++; + cursor_char_position = 0; + } + } int num_command_matches; |