Description
Run this example program on OSX 10.13.5 terminal & a bunch of garbage escaped escape codes are printed to the screen.
from prompt_toolkit.completion import WordCompleter
from prompt_toolkit.eventloop.defaults import use_asyncio_event_loop
from prompt_toolkit.patch_stdout import patch_stdout
from prompt_toolkit.shortcuts import CompleteStyle
from prompt_toolkit.shortcuts.prompt import prompt
from threading import Thread
from prompt_toolkit.output.vt100 import Vt100_Output
import time
def spam_print():
while True:
print("This is spam")
Thread(target=spam_print, daemon=True).start()
while True:
with patch_stdout():
prompt("> ", rprompt="test", complete_style=CompleteStyle.MULTI_COLUMN,
completer=WordCompleter(list(chr(c) * 20 for c in range(ord("a"), ord("z")))))
Example corruption pasted below. Sometimes the terminal will even output the bell sound which to me indicates this corruption also sometimes manifests as the escape codes being written raw to the terminal. I have been unable to track down where/how the escape codes/buffer corruption is coming in (looks fine AFAICT within the patch proxy).
This is spam
This is spam
This is spam
^[[57;1R^[[51;9R^[[51;17R^[[51;26R^[[51;35R^[[51;44R^[[51;53R^[[51;62R^[[51;71R^[[51;80R^[[51;89R^[[51;98R^[[51;107R^[[51;117R^[[51;127R^[[51;137R^[[51;147R^[[51;157R^[[51;167R^[[51;177R^[[51;187R^[[51;197R^This is spam
^[[57;1R^[[51;9R^[[51;17R^[[51;26R^[[51;35R^[[51;44R^[[51;53R^[[51;62R^[[51;71R^[[51;80R^[[51;89R^[[51;98R^[[51;107R^[[51;117R^[[51;127R^[[51;137R^[[51;147R^[[51;157R^[[51;167R^[[51;177R^[[51;187R^[[51;197R^This is spam
^[[57;1R^[[51;9R^[[51;17R^[[51;26R^[[51;35R^[[51;44R^[[51;53R^[[51;62R^[[51;71R^[[51;80R^[[51;89R^[[51;98R^[[51;107R^[[51;117R^[[51;127R^[[51;137R^[[51;147R^[[51;157R^[[51;167R^[[51;177R^[[51;187R^[[51;197R^This is spam
^[[57;1R^[[51;9R^[[51;17R^[[51;26R^[[51;35R^[[51;44R^[[51;53R^[[51;62R^[[51;71R^[[51;80R^[[51;89R^[[51;98R^[[51;107R^[[51;117R^[[51;127R^[[51;137R^[[51;147R^[[51;157R^[[51;167R^[[51;177R^[[51;187R^[[51;197R^This is spam
^[[57;1R^[[51;9R^[[51;17R^[[51;26R^[[51;35R^[[51;44R^[[51;53R^[[51;62R^[[51;71R^[[51;80R^[[51;89R^[[51;98R^[[51;107R^[[51;117R^[[51;127R^[[51;137R^[[51;147R^[[51;157R^[[51;167R^[[51;177R^[[51;187R^[[51;197R^This is spam
^[[57;1R^[[51;9R^[[51;17R^[[51;26R^[[51;35R^[[51;44R^[[51;53R^[[51;62R^[[51;71R^[[51;80R^[[51;89R^[[51;98R^[[51;107R^[[51;117R^[[51;127R^[[51;137R^[[51;147R^[[51;157R^[[51;167R^[[51;177R^[[51;187R^[[51;197R^This is spam
^[[57;1R^[[51;9R^[[51;17R^[[51;26R^[[51;35R^[[51;44R^[[51;53R^[[51;62R^[[51;71R^[[51;80R^[[51;89R^[[51;98R^[[51;107R^[[51;117R^[[51;127R^[[51;137R^[[51;147R^[[51;157R^[[51;167R^[[51;177R^[[51;187R^[[51;197R^This is spam
This is spam
This is spam
This is spam
This is spam
This is spam
This is spam
This is spam
This is spam
This is spam
^[[51;3R^[[51;9R^[[51;17RThis is spam
This is spam
This is spam
This is spam