summaryrefslogtreecommitdiffstats
path: root/lldb/source/Commands/CommandObjectSettings.cpp
diff options
context:
space:
mode:
authorJohnny Chen <johnny.chen@apple.com>2012-01-20 23:02:51 +0000
committerJohnny Chen <johnny.chen@apple.com>2012-01-20 23:02:51 +0000
commit98aceb08f8d4e44fd7c397ba80de8942a48d0fb8 (patch)
treec07c501cc418080e4f6888738012ced4bf606f94 /lldb/source/Commands/CommandObjectSettings.cpp
parent30398dd4108f8c5376e863ca665e29098f68db57 (diff)
downloadbcm5719-llvm-98aceb08f8d4e44fd7c397ba80de8942a48d0fb8.tar.gz
bcm5719-llvm-98aceb08f8d4e44fd7c397ba80de8942a48d0fb8.zip
o CommandObjectSettingsSet.cpp:
Fix a bug where "settings set -r th" wouldn't complete. o UserSettingsController.cpp: Fix a bug where "settings set target.process." wouldn't complete. o test/functionalities/completion: Add various completion test cases related to 'settings set' command. llvm-svn: 148596
Diffstat (limited to 'lldb/source/Commands/CommandObjectSettings.cpp')
-rw-r--r--lldb/source/Commands/CommandObjectSettings.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/lldb/source/Commands/CommandObjectSettings.cpp b/lldb/source/Commands/CommandObjectSettings.cpp
index 1a2ce9d835f..2a8b4247275 100644
--- a/lldb/source/Commands/CommandObjectSettings.cpp
+++ b/lldb/source/Commands/CommandObjectSettings.cpp
@@ -188,7 +188,11 @@ CommandObjectSettingsSet::HandleArgumentCompletion (Args &input,
completion_str.erase (cursor_char_position);
// Attempting to complete variable name
- if (cursor_index == 1)
+ llvm::StringRef prev_str(cursor_index == 2 ? input.GetArgumentAtIndex(1) : "");
+ if (cursor_index == 1 ||
+ (cursor_index == 2 && prev_str.startswith("-")) // "settings set -r th", followed by Tab.
+ )
+ {
CommandCompletions::InvokeCommonCompletionCallbacks (m_interpreter,
CommandCompletions::eSettingsNameCompletion,
completion_str.c_str(),
@@ -197,6 +201,10 @@ CommandObjectSettingsSet::HandleArgumentCompletion (Args &input,
NULL,
word_complete,
matches);
+ // If there is only 1 match which fulfills the completion request, do an early return.
+ if (matches.GetSize() == 1 && completion_str.compare(matches.GetStringAtIndex(0)) != 0)
+ return 1;
+ }
// Attempting to complete value
if ((cursor_index == 2) // Partly into the variable's value
OpenPOWER on IntegriCloud