Block 'start:wait' during initial load

- Init searchInProgress before reader starts so start:wait waits for
  the first complete result set instead of no-op'ing
- Add test_wait_action_start
This commit is contained in:
Junegunn Choi
2026-07-01 18:49:20 +09:00
parent 1d9d7cd417
commit 6358d6f4f1
2 changed files with 17 additions and 1 deletions
+5 -1
View File
@@ -1169,7 +1169,11 @@ func NewTerminal(opts *Options, eventBox *util.EventBox, executor *util.Executor
lastAction: actStart,
lastFocus: minItem.Index(),
lastActivity: time.Now(),
numLinesCache: make(map[int32]numLinesCacheValue)}
// Consider the initial load a search in progress so 'start:wait' blocks
// until the first result set is complete. Set here, before the reader
// starts, so the first final() result correctly clears it.
searchInProgress: true,
numLinesCache: make(map[int32]numLinesCacheValue)}
if opts.AcceptNth != nil {
t.acceptNth = opts.AcceptNth(t.delimiter)
}
+12
View File
@@ -1173,6 +1173,18 @@ class TestCore < TestInteractive
tmux.until { |lines| assert_equal 1, lines.match_count }
end
def test_wait_action_start
# 'start:wait' blocks on the initial load until reading completes
tmux.send_keys %((seq 100; sleep 60) | #{FZF} --bind 'start:wait'), :Enter
tmux.until { |lines| assert_equal 100, lines.match_count }
tmux.until { |lines| assert lines.any_include?('(..)') }
tmux.send_keys 'C-c'
tmux.until { |lines| refute lines.any_include?('(..)') }
# Ctrl-C cancels the wait; fzf keeps running and accepts input again
tmux.send_keys '99'
tmux.until { |lines| assert_equal 1, lines.match_count }
end
def test_clear_selection
tmux.send_keys %(seq 100 | #{FZF} --multi --bind space:clear-selection), :Enter
tmux.until { |lines| assert_equal 100, lines.match_count }