File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -75,22 +75,24 @@ def pyreadline_remove_history_item(pos: int) -> None:
7575 readline_lib = ctypes .CDLL (readline .__file__ )
7676
7777
78+ # noinspection PyProtectedMember
7879def rl_force_redisplay () -> None :
7980 """
80- Causes readline to redraw prompt and input line
81+ Causes readline to display the prompt and input text wherever the cursor is and start
82+ reading input from this location. This is the proper way to restore the input line after
83+ printing to the screen
8184 """
8285 if not sys .stdout .isatty ():
8386 return
8487
8588 if rl_type == RlType .GNU : # pragma: no cover
86- # rl_forced_update_display() is the proper way to redraw the prompt and line, but we
87- # have to use ctypes to do it since Python's readline API does not wrap the function
8889 readline_lib .rl_forced_update_display ()
8990
9091 # After manually updating the display, readline asks that rl_display_fixed be set to 1 for efficiency
9192 display_fixed = ctypes .c_int .in_dll (readline_lib , "rl_display_fixed" )
9293 display_fixed .value = 1
9394
9495 elif rl_type == RlType .PYREADLINE : # pragma: no cover
95- # noinspection PyProtectedMember
96+ # Call _print_prompt() first to set the new location of the prompt
9697 readline .rl .mode ._print_prompt ()
98+ readline .rl .mode ._update_line ()
You can’t perform that action at this time.
0 commit comments