Skip to content

Commit

Permalink
[mainloop-] wait less time between quick replay commands #2635
Browse files Browse the repository at this point in the history
  • Loading branch information
midichef authored and anjakefala committed Jan 4, 2025
1 parent 6279862 commit aa63d5b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions visidata/mainloop.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,13 +251,14 @@ def mainloop(vd, scr):
vd.checkForFinishedThreads()
vd.callNoExceptions(sheet.checkCursor)

# no idle redraw unless background threads are running
time.sleep(0) # yield to other threads which may not have started yet
if vd._nextCommands:
if vd.options.replay_wait > 0:
vd.curses_timeout = int(vd.options.replay_wait*1000)
else:
if vd.unfinishedThreads: #2369 #2635
# while running a bg thread for a command, schedule infrequent redraws
vd.curses_timeout = nonidle_timeout
else:
# otherwise, schedule the next redraw and command (immediately, for default replay_wait)
vd.curses_timeout = int(vd.options.replay_wait*1000)
elif vd.unfinishedThreads:
vd.curses_timeout = nonidle_timeout
else:
Expand Down

0 comments on commit aa63d5b

Please sign in to comment.