summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md4
-rw-r--r--cmd2/argparse_completer.py8
-rwxr-xr-xtests/test_completion.py1
3 files changed, 11 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d20e678c..82b72ba4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 1.4.1 (TBD, 2020)
+* Bug Fixes
+ * Fixed bug where setting `always_show_hint=True` did not show a hint when completing `Settables`
+
## 1.4.0 (November 11, 2020)
* Bug Fixes
* Fixed tab completion crash on Windows
diff --git a/cmd2/argparse_completer.py b/cmd2/argparse_completer.py
index 7484358d..117bfd50 100644
--- a/cmd2/argparse_completer.py
+++ b/cmd2/argparse_completer.py
@@ -415,7 +415,9 @@ class ArgparseCompleter:
# If we have results, then return them
if completion_results:
- self._cmd2_app.completion_hint = _build_hint(self._parser, flag_arg_state.action)
+ # Don't overwrite an existing hint
+ if not self._cmd2_app.completion_hint:
+ self._cmd2_app.completion_hint = _build_hint(self._parser, flag_arg_state.action)
return completion_results
# Otherwise, print a hint if the flag isn't finished or text isn't possibly the start of a flag
@@ -437,7 +439,9 @@ class ArgparseCompleter:
# If we have results, then return them
if completion_results:
- self._cmd2_app.completion_hint = _build_hint(self._parser, pos_arg_state.action)
+ # Don't overwrite an existing hint
+ if not self._cmd2_app.completion_hint:
+ self._cmd2_app.completion_hint = _build_hint(self._parser, pos_arg_state.action)
return completion_results
# Otherwise, print a hint if text isn't possibly the start of a flag
diff --git a/tests/test_completion.py b/tests/test_completion.py
index 48a055d0..db243f48 100755
--- a/tests/test_completion.py
+++ b/tests/test_completion.py
@@ -972,6 +972,7 @@ def test_complete_set_value(cmd2_app):
first_match = complete_tester(text, line, begidx, endidx, cmd2_app)
assert first_match == "SUCCESS "
+ assert cmd2_app.completion_hint == "Hint:\n value a settable param\n"
def test_complete_set_value_invalid_settable(cmd2_app, capsys):
text = ''