diff options
author | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2022-01-12 14:40:53 -0500 |
---|---|---|
committer | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2022-01-12 14:40:53 -0500 |
commit | ef83f1dbe9389b3ebe001cd8f43c8e9fcfc5079e (patch) | |
tree | b8f6c1d529379ba836879dd1406c9bc323618b5d | |
parent | c1f6114d52161a3b8a32d3cee1c495d79052e1fb (diff) | |
download | cmd2-git-blank_prompt.tar.gz |
Fixed issue in ansi.async_alert_str() which would raise IndexError if prompt was blank.blank_prompt
-rw-r--r-- | CHANGELOG.md | 2 | ||||
-rw-r--r-- | cmd2/ansi.py | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 49952975..b1a49caf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,6 @@ ## 2.3.4 (TBD, 2021) +* Bug Fixes + * Fixed issue in `ansi.async_alert_str()` which would raise `IndexError` if prompt was blank. * Enhancements * Added broader exception handling when enabling clipboard functionality via `pyperclip`. diff --git a/cmd2/ansi.py b/cmd2/ansi.py index 29d09fff..fba6e050 100644 --- a/cmd2/ansi.py +++ b/cmd2/ansi.py @@ -1046,7 +1046,7 @@ def async_alert_str(*, terminal_columns: int, prompt: str, line: str, cursor_off """ # Split the prompt lines since it can contain newline characters. - prompt_lines = prompt.splitlines() + prompt_lines = prompt.splitlines() or [''] # Calculate how many terminal lines are taken up by all prompt lines except for the last one. # That will be included in the input lines calculations since that is where the cursor is. |