File tree Expand file tree Collapse file tree 2 files changed +11
-7
lines changed
Expand file tree Collapse file tree 2 files changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -71,8 +71,8 @@ def enable_win_vt100(handle: HANDLE) -> bool:
7171 # Enable VT100 sequences for stdout and stderr
7272 STD_OUT_HANDLE = - 11
7373 STD_ERROR_HANDLE = - 12
74- vt100_support = enable_win_vt100 (readline .rl .console .GetStdHandle (STD_OUT_HANDLE )) and \
75- enable_win_vt100 (readline .rl .console .GetStdHandle (STD_ERROR_HANDLE ))
74+ vt100_support = ( enable_win_vt100 (readline .rl .console .GetStdHandle (STD_OUT_HANDLE )) and
75+ enable_win_vt100 (readline .rl .console .GetStdHandle (STD_ERROR_HANDLE ) ))
7676
7777 ############################################################################################################
7878 # 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
174174 readline .rl ._set_prompt (safe_prompt )
175175
176176
177- def rl_make_safe_prompt (prompt : str , start : str = " \x01 " , end : str = " \x02 " ) -> str : # pragma: no cover
177+ def rl_make_safe_prompt (prompt : str ) -> str : # pragma: no cover
178178 """Overcome bug in GNU Readline in relation to calculation of prompt length in presence of ANSI escape codes.
179179
180180 :param prompt: original prompt
181- :param start: start code to tell GNU Readline about beginning of invisible characters
182- :param end: end code to tell GNU Readline about end of invisible characters
183181 :return: prompt safe to pass to GNU Readline
184182 """
185183 if rl_type == RlType .GNU :
184+ # start code to tell GNU Readline about beginning of invisible characters
185+ start = "\x01 "
186+
187+ # end code to tell GNU Readline about end of invisible characters
188+ end = "\x02 "
189+
186190 escaped = False
187191 result = ""
188192
Original file line number Diff line number Diff line change @@ -209,13 +209,13 @@ async_update_prompt()
209209 a system status or increase a counter to report an event.
210210
211211``cmd2 `` also provides a function to change the title of the terminal window. This feature requires the
212- application be running in a terminal that support VT100 control characters. Linux, Mac, and Windows 10 and
212+ application be running in a terminal that supports VT100 control characters. Linux, Mac, and Windows 10 and
213213greater all support these.
214214
215215set_window_title()
216216 Sets the terminal window title
217217
218218
219- The easiest way to understand these function is to see the AsyncPrinting _ example for a demonstration.
219+ The easiest way to understand these functions is to see the AsyncPrinting _ example for a demonstration.
220220
221221.. _AsyncPrinting : https://github.com/python-cmd2/cmd2/blob/master/examples/async_printing.py
You can’t perform that action at this time.
0 commit comments