Skip to content

Commit 2ffdefb

Browse files
committed
Improved responsiveness when setting windows title and printing alerts
1 parent e3b6824 commit 2ffdefb

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 0.9.24 (TBD, 2020)
2+
* Enhancements
3+
* Flushing stderr when setting the window title and printing alerts for better responsiveness in cases where
4+
stderr is not unbuffered.
5+
16
## 0.9.23 (January 9, 2020)
27
* Bug Fixes
38
* Fixed bug where startup script containing a single quote in its file name was incorrectly quoted

cmd2/cmd2.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3802,6 +3802,7 @@ def async_alert(self, alert_msg: str, new_prompt: Optional[str] = None) -> None:
38023802
cursor_offset=rl_get_point(), alert_msg=alert_msg)
38033803
if rl_type == RlType.GNU:
38043804
sys.stderr.write(terminal_str)
3805+
sys.stderr.flush()
38053806
elif rl_type == RlType.PYREADLINE:
38063807
# noinspection PyUnresolvedReferences
38073808
readline.rl.mode.console.write(terminal_str)
@@ -3854,6 +3855,7 @@ def set_window_title(self, title: str) -> None: # pragma: no cover
38543855
if self.terminal_lock.acquire(blocking=False):
38553856
try:
38563857
sys.stderr.write(ansi.set_title_str(title))
3858+
sys.stderr.flush()
38573859
except AttributeError:
38583860
# Debugging in Pycharm has issues with setting terminal title
38593861
pass

0 commit comments

Comments
 (0)