aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Commands/CommandObjectHelp.cpp
diff options
context:
space:
mode:
authorJim Ingham <jingham@apple.com>2011-10-26 19:32:01 +0000
committerJim Ingham <jingham@apple.com>2011-10-26 19:32:01 +0000
commit1d18ebf62a4925866d3bff3cd5708a46994a8740 (patch)
treed90b726f08732ea149b4b8da68a12a26e4865e30 /lldb/source/Commands/CommandObjectHelp.cpp
parentcab9a7d51c174b13498ebd75ceda801692198755 (diff)
downloadllvm-1d18ebf62a4925866d3bff3cd5708a46994a8740.zip
llvm-1d18ebf62a4925866d3bff3cd5708a46994a8740.tar.gz
llvm-1d18ebf62a4925866d3bff3cd5708a46994a8740.tar.bz2
When completing "help foo bar" if "foo" is not a real command, don't ask its NULL command object to complete the line.
llvm-svn: 143047
Diffstat (limited to 'lldb/source/Commands/CommandObjectHelp.cpp')
-rw-r--r--lldb/source/Commands/CommandObjectHelp.cpp35
1 files changed, 26 insertions, 9 deletions
diff --git a/lldb/source/Commands/CommandObjectHelp.cpp b/lldb/source/Commands/CommandObjectHelp.cpp
index dd68f7c..e735c66 100644
--- a/lldb/source/Commands/CommandObjectHelp.cpp
+++ b/lldb/source/Commands/CommandObjectHelp.cpp
@@ -263,14 +263,31 @@ CommandObjectHelp::HandleCompletion
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);
+ }
}
}