[Lldb-commits] [lldb] r121785 - /lldb/trunk/source/Interpreter/CommandInterpreter.cpp
Jim Ingham
jingham at apple.com
Tue Dec 14 11:56:02 PST 2010
Author: jingham
Date: Tue Dec 14 13:56:01 2010
New Revision: 121785
URL: http://llvm.org/viewvc/llvm-project?rev=121785&view=rev
Log:
Fix the completion of "fr " and the like.
Modified:
lldb/trunk/source/Interpreter/CommandInterpreter.cpp
Modified: lldb/trunk/source/Interpreter/CommandInterpreter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandInterpreter.cpp?rev=121785&r1=121784&r2=121785&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/CommandInterpreter.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp Tue Dec 14 13:56:01 2010
@@ -1007,6 +1007,23 @@
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;
More information about the lldb-commits
mailing list