diff options
author | kotfu <kotfu@kotfu.net> | 2018-06-22 16:27:16 -0600 |
---|---|---|
committer | kotfu <kotfu@kotfu.net> | 2018-06-22 16:27:16 -0600 |
commit | e5ff9b5787867310fbf350d8b4919b7238015917 (patch) | |
tree | 3cc0960241e9128ecdf346dce967c647880fec8a /cmd2 | |
parent | a73c061b82ac1824db8e1747698c90c0ae7766b1 (diff) | |
parent | c7feaa60e46563cd60c217d27f888a05c9c3439d (diff) | |
download | cmd2-git-e5ff9b5787867310fbf350d8b4919b7238015917.tar.gz |
Merge branch 'master' into plugin_functions
Diffstat (limited to 'cmd2')
-rw-r--r-- | cmd2/rl_utils.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/cmd2/rl_utils.py b/cmd2/rl_utils.py index 55ca4a12..7e49ea47 100644 --- a/cmd2/rl_utils.py +++ b/cmd2/rl_utils.py @@ -75,16 +75,17 @@ elif 'gnureadline' in sys.modules or 'readline' in sys.modules: readline_lib = ctypes.CDLL(readline.__file__) +# noinspection PyProtectedMember def rl_force_redisplay() -> None: """ - Causes readline to redraw prompt and input line + Causes readline to display the prompt and input text wherever the cursor is and start + reading input from this location. This is the proper way to restore the input line after + printing to the screen """ if not sys.stdout.isatty(): return if rl_type == RlType.GNU: # pragma: no cover - # rl_forced_update_display() is the proper way to redraw the prompt and line, but we - # have to use ctypes to do it since Python's readline API does not wrap the function readline_lib.rl_forced_update_display() # After manually updating the display, readline asks that rl_display_fixed be set to 1 for efficiency @@ -92,5 +93,6 @@ def rl_force_redisplay() -> None: display_fixed.value = 1 elif rl_type == RlType.PYREADLINE: # pragma: no cover - # noinspection PyProtectedMember + # Call _print_prompt() first to set the new location of the prompt readline.rl.mode._print_prompt() + readline.rl.mode._update_line() |