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 460a2018..652c495c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -13,6 +13,10 @@
See [read_input.py](https://github.com/python-cmd2/cmd2/blob/master/examples/read_input.py)
for an example.
+## 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 316d4666..f42e2a88 100644
--- a/cmd2/argparse_completer.py
+++ b/cmd2/argparse_completer.py
@@ -423,7 +423,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
@@ -444,7 +446,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 48f93a5a..a9f2a51b 100755
--- a/tests/test_completion.py
+++ b/tests/test_completion.py
@@ -971,6 +971,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 = ''