commit 55c9afceac1eda9f2a66023983ec05a55cd073a4
parent d0b8f05c221e4005a61602481395fba1d424525e
Author: Dan Callaghan <djc@djc.id.au>
Date: Sun, 5 Apr 2026 12:22:24 +1000
configurable hysteresis delay for loading more threads
Mainly this is for the tests, to avoid needing to sprinkle a bunch of
sleep 0.5 throughout them.
Diffstat:
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/lib/sup/modes/line_cursor_mode.rb b/lib/sup/modes/line_cursor_mode.rb
@@ -20,8 +20,11 @@ class LineCursorMode < ScrollMode
while true
e = @load_more_q.pop
@load_more_callbacks.each { |c| c.call e }
- sleep 0.5
- @load_more_q.pop until @load_more_q.empty?
+ hysteresis = $config[:load_more_threads_hysteresis] || 0.5
+ if hysteresis > 0 then
+ sleep hysteresis
+ @load_more_q.pop until @load_more_q.empty?
+ end
end
end
diff --git a/test/unit/test_line_cursor_mode.rb b/test/unit/test_line_cursor_mode.rb
@@ -6,6 +6,7 @@ require "sup"
class TestLineCursorMode < Minitest::Test
def setup
$config = {
+ :load_more_threads_hysteresis => 0,
:load_more_threads_when_scrolling => true,
:continuous_scroll => false,
}