From 7d2ef16cb360dbd95e276b80b85c6ff9ce69dc23 Mon Sep 17 00:00:00 2001 From: Greg Clayton Date: Fri, 29 Mar 2013 17:03:23 +0000 Subject: Enable tab completion for regular expression commands. llvm-svn: 178348 --- .../Interpreter/CommandObjectRegexCommand.cpp | 36 ++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) (limited to 'lldb/source/Interpreter/CommandObjectRegexCommand.cpp') diff --git a/lldb/source/Interpreter/CommandObjectRegexCommand.cpp b/lldb/source/Interpreter/CommandObjectRegexCommand.cpp index 05d6e09b6b1..25b02baf54a 100644 --- a/lldb/source/Interpreter/CommandObjectRegexCommand.cpp +++ b/lldb/source/Interpreter/CommandObjectRegexCommand.cpp @@ -30,11 +30,13 @@ CommandObjectRegexCommand::CommandObjectRegexCommand const char *name, const char *help, const char *syntax, - uint32_t max_matches + uint32_t max_matches, + uint32_t completion_type_mask ) : CommandObjectRaw (interpreter, name, help, syntax), m_max_matches (max_matches), - m_entries () + m_entries (), + m_completion_type_mask (completion_type_mask) { } @@ -114,3 +116,33 @@ CommandObjectRegexCommand::AddRegexCommand (const char *re_cstr, const char *com m_entries.pop_back(); return false; } + +int +CommandObjectRegexCommand::HandleCompletion (Args &input, + int &cursor_index, + int &cursor_char_position, + int match_start_point, + int max_return_elements, + bool &word_complete, + StringList &matches) +{ + if (m_completion_type_mask) + { + std::string completion_str (input.GetArgumentAtIndex (cursor_index), cursor_char_position); + CommandCompletions::InvokeCommonCompletionCallbacks (m_interpreter, + m_completion_type_mask, + completion_str.c_str(), + match_start_point, + max_return_elements, + NULL, + word_complete, + matches); + return matches.GetSize(); + } + else + { + matches.Clear(); + word_complete = false; + } + return 0; +} -- cgit v1.2.3