From 87c99f215182930e12814b96f5ac35dfa2db078a Mon Sep 17 00:00:00 2001 From: midichef <67946319+midichef@users.noreply.github.com> Date: Sat, 14 Dec 2024 14:28:36 -0800 Subject: [PATCH] [mainloop-] wait less time between quick replay commands #2635 --- visidata/mainloop.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/visidata/mainloop.py b/visidata/mainloop.py index 7b986306e..432498229 100644 --- a/visidata/mainloop.py +++ b/visidata/mainloop.py @@ -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: