[Lldb-commits] [lldb] r143047 - /lldb/trunk/source/Commands/CommandObjectHelp.cpp

Jim Ingham jingham at apple.com
Wed Oct 26 12:32:01 PDT 2011


Author: jingham
Date: Wed Oct 26 14:32:01 2011
New Revision: 143047

URL: http://llvm.org/viewvc/llvm-project?rev=143047&view=rev
Log:
When completing "help foo bar" if "foo" is not a real command, don't ask its NULL command object to complete the line.

Modified:
    lldb/trunk/source/Commands/CommandObjectHelp.cpp

Modified: lldb/trunk/source/Commands/CommandObjectHelp.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectHelp.cpp?rev=143047&r1=143046&r2=143047&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectHelp.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectHelp.cpp Wed Oct 26 14:32:01 2011
@@ -263,14 +263,31 @@
     else
     {
         CommandObject *cmd_obj = m_interpreter.GetCommandObject (input.GetArgumentAtIndex(0));
-        input.Shift();
-        cursor_index--;
-        return cmd_obj->HandleCompletion (input, 
-                                          cursor_index, 
-                                          cursor_char_position, 
-                                          match_start_point, 
-                                          max_return_elements, 
-                                          word_complete, 
-                                          matches);
+        
+        // The command that they are getting help on might be ambiguous, in which case we should complete that,
+        // otherwise complete with the command the user is getting help on...
+        
+        if (cmd_obj)
+        {
+            input.Shift();
+            cursor_index--;
+            return cmd_obj->HandleCompletion (input, 
+                                              cursor_index, 
+                                              cursor_char_position, 
+                                              match_start_point, 
+                                              max_return_elements, 
+                                              word_complete, 
+                                              matches);
+        }
+        else
+        {
+            return m_interpreter.HandleCompletionMatches (input, 
+                                                        cursor_index, 
+                                                        cursor_char_position, 
+                                                        match_start_point, 
+                                                        max_return_elements, 
+                                                        word_complete, 
+                                                        matches);
+        }
     }
 }





More information about the lldb-commits mailing list