Limit how much is shown in display_during_execution

This commit is contained in:
Grant Sanderson 2021-01-07 16:37:01 -08:00
parent 7b8677fd6c
commit 42a3c56898

View file

@ -128,8 +128,10 @@ def dvi_to_svg(dvi_file, regen_if_exists=False):
# TODO, perhaps this should live elsewhere
@contextmanager
def display_during_execution(message):
# Only show top line
to_print = message.split("\n")[0]
try:
print(message, end="\r")
print(to_print, end="\r")
yield
finally:
print(" " * len(message), end="\r")
print(" " * len(to_print), end="\r")