diff options
author | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2018-09-25 19:10:46 -0400 |
---|---|---|
committer | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2018-09-25 19:10:46 -0400 |
commit | 39e43d6329eb517ac58f95a8ca37e7e489d446cb (patch) | |
tree | 7244b69c9ea882c81a5379426f93ba2b2281229c | |
parent | 5f46487bf7909045f217c89c7ade2d9fa89ebd7b (diff) | |
download | cmd2-git-39e43d6329eb517ac58f95a8ca37e7e489d446cb.tar.gz |
Addressing code review comments
-rw-r--r-- | cmd2/rl_utils.py | 14 | ||||
-rw-r--r-- | docs/unfreefeatures.rst | 4 |
2 files changed, 11 insertions, 7 deletions
diff --git a/cmd2/rl_utils.py b/cmd2/rl_utils.py index 3fac5696..0819232d 100644 --- a/cmd2/rl_utils.py +++ b/cmd2/rl_utils.py @@ -71,8 +71,8 @@ if 'pyreadline' in sys.modules: # Enable VT100 sequences for stdout and stderr STD_OUT_HANDLE = -11 STD_ERROR_HANDLE = -12 - vt100_support = enable_win_vt100(readline.rl.console.GetStdHandle(STD_OUT_HANDLE)) and \ - enable_win_vt100(readline.rl.console.GetStdHandle(STD_ERROR_HANDLE)) + vt100_support = (enable_win_vt100(readline.rl.console.GetStdHandle(STD_OUT_HANDLE)) and + enable_win_vt100(readline.rl.console.GetStdHandle(STD_ERROR_HANDLE))) ############################################################################################################ # pyreadline is incomplete in terms of the Python readline API. Add the missing functions we need. @@ -174,15 +174,19 @@ def rl_set_prompt(prompt: str) -> None: # pragma: no cover readline.rl._set_prompt(safe_prompt) -def rl_make_safe_prompt(prompt: str, start: str = "\x01", end: str = "\x02") -> str: # pragma: no cover +def rl_make_safe_prompt(prompt: str) -> str: # pragma: no cover """Overcome bug in GNU Readline in relation to calculation of prompt length in presence of ANSI escape codes. :param prompt: original prompt - :param start: start code to tell GNU Readline about beginning of invisible characters - :param end: end code to tell GNU Readline about end of invisible characters :return: prompt safe to pass to GNU Readline """ if rl_type == RlType.GNU: + # start code to tell GNU Readline about beginning of invisible characters + start = "\x01" + + # end code to tell GNU Readline about end of invisible characters + end = "\x02" + escaped = False result = "" diff --git a/docs/unfreefeatures.rst b/docs/unfreefeatures.rst index 60630258..b5f9415d 100644 --- a/docs/unfreefeatures.rst +++ b/docs/unfreefeatures.rst @@ -209,13 +209,13 @@ async_update_prompt() a system status or increase a counter to report an event. ``cmd2`` also provides a function to change the title of the terminal window. This feature requires the -application be running in a terminal that support VT100 control characters. Linux, Mac, and Windows 10 and +application be running in a terminal that supports VT100 control characters. Linux, Mac, and Windows 10 and greater all support these. set_window_title() Sets the terminal window title -The easiest way to understand these function is to see the AsyncPrinting_ example for a demonstration. +The easiest way to understand these functions is to see the AsyncPrinting_ example for a demonstration. .. _AsyncPrinting: https://github.com/python-cmd2/cmd2/blob/master/examples/async_printing.py |