Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[mainloop-] during replay, redraw less often #2369

Merged
merged 4 commits into from
May 22, 2024
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 6 additions & 3 deletions visidata/mainloop.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ def mainloop(vd, scr):
vd.disp_help = vd.options.disp_help

vd.keystrokes = ''
vd.drawThread = threading.current_thread()
while True:
if not vd.stackedSheets and vd.currentReplay is None:
return
Expand All @@ -178,7 +179,6 @@ def mainloop(vd, scr):
continue # waiting for replay to push sheet

threading.current_thread().sheet = sheet
vd.drawThread = threading.current_thread()

vd.setWindows(vd.scrFull)

Expand Down Expand Up @@ -250,12 +250,15 @@ def mainloop(vd, scr):
# no idle redraw unless background threads are running
time.sleep(0) # yield to other threads which may not have started yet
if vd._nextCommands:
vd.curses_timeout = int(vd.options.replay_wait*1000)
if vd.options.replay_wait > 0:
vd.curses_timeout = int(vd.options.replay_wait*1000)
else:
vd.curses_timeout = nonidle_timeout
elif vd.unfinishedThreads:
vd.curses_timeout = nonidle_timeout
else:
numTimeouts += 1
if vd.timeouts_before_idle >= 0 and numTimeouts > vd.timeouts_before_idle:
if vd.timeouts_before_idle >= 0 and numTimeouts >= vd.timeouts_before_idle:
vd.curses_timeout = -1
else:
vd.curses_timeout = nonidle_timeout
Expand Down