Fix the completion of "fr " and the like.

llvm-svn: 121785
This commit is contained in:
Jim Ingham 2010-12-14 19:56:01 +00:00
parent f636a64bfe
commit fe0c425308
1 changed files with 17 additions and 0 deletions

View File

@ -1008,6 +1008,23 @@ CommandInterpreter::HandleCompletion (const char *current_line,
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;
matches.Clear();