Skip to content

Commit 081a06b

Browse files
authored
Fixed issue in ansi.async_alert_str() which would raise IndexError if prompt was blank. (#1188)
1 parent c1f6114 commit 081a06b

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
## 2.3.4 (TBD, 2021)
2+
* Bug Fixes
3+
* Fixed issue in `ansi.async_alert_str()` which would raise `IndexError` if prompt was blank.
24
* Enhancements
35
* Added broader exception handling when enabling clipboard functionality via `pyperclip`.
46

cmd2/ansi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1046,7 +1046,7 @@ def async_alert_str(*, terminal_columns: int, prompt: str, line: str, cursor_off
10461046
"""
10471047

10481048
# Split the prompt lines since it can contain newline characters.
1049-
prompt_lines = prompt.splitlines()
1049+
prompt_lines = prompt.splitlines() or ['']
10501050

10511051
# Calculate how many terminal lines are taken up by all prompt lines except for the last one.
10521052
# That will be included in the input lines calculations since that is where the cursor is.

0 commit comments

Comments
 (0)