[Lldb-commits] [lldb] r175717 - Add some documentation on how HandleCommand work.

Jim Ingham jingham at apple.com
Wed Feb 20 19:17:20 PST 2013


Author: jingham
Date: Wed Feb 20 21:17:20 2013
New Revision: 175717

URL: http://llvm.org/viewvc/llvm-project?rev=175717&view=rev
Log:
Add some documentation on how HandleCommand work.

Modified:
    lldb/trunk/include/lldb/API/SBCommandInterpreter.h

Modified: lldb/trunk/include/lldb/API/SBCommandInterpreter.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBCommandInterpreter.h?rev=175717&r1=175716&r2=175717&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBCommandInterpreter.h (original)
+++ lldb/trunk/include/lldb/API/SBCommandInterpreter.h Wed Feb 20 21:17:20 2013
@@ -85,8 +85,18 @@ public:
     lldb::ReturnStatus
     HandleCommand (const char *command_line, lldb::SBCommandReturnObject &result, bool add_to_history = false);
 
-    // This interface is not useful in SWIG, since the cursor & last_char arguments are string pointers INTO current_line
-    // and you can't do that in a scripting language interface in general... 
+    // The pointer based interface is not useful in SWIG, since the cursor & last_char arguments are string pointers INTO current_line
+    // and you can't do that in a scripting language interface in general...
+    
+    // In either case, the way this works is that the you give it a line and cursor position in the line.  The function
+    // will return the number of completions.  The matches list will contain number_of_completions + 1 elements.  The first
+    // element is the common substring after the cursor position for all the matches.  The rest of the elements are the
+    // matches.  The first element is useful if you are emulating the common shell behavior where the tab completes
+    // to the string that is common among all the matches, then you should first check if the first element is non-empty,
+    // and if so just insert it and move the cursor to the end of the insertion.  The next tab will return an empty
+    // common substring, and a list of choices (if any), at which point you should display the choices and let the user
+    // type further to disambiguate.
+    
     int
     HandleCompletion (const char *current_line,
                       const char *cursor,





More information about the lldb-commits mailing list