mirror of
https://github.com/junegunn/fzf.git
synced 2026-08-01 13:40:31 +08:00
Add 'wait' action to block fzf until search completion
The 'wait' action blocks subsequent action execution until the current search completes. This is essential for chaining actions after query-changing actions (e.g. transform-search(...)+wait+best), ensuring motion actions operate on complete results rather than stale data. - Blocks all user input except ESC/CTRL-C while waiting - Shows visual feedback: dimmed query, (..) indicator, hidden cursor - Clears pending actions if user cancels with ESC/CTRL-C Closes: #4825
This commit is contained in:
@@ -1162,6 +1162,14 @@ class TestCore < TestInteractive
|
||||
tmux.until { |lines| assert_equal 10, lines.match_count }
|
||||
end
|
||||
|
||||
def test_wait_action
|
||||
tmux.send_keys %((seq 100; sleep 60) | #{FZF} --bind 'start:search(1)+wait+best'), :Enter
|
||||
tmux.until { |lines| assert_equal 20, lines.match_count }
|
||||
tmux.until { |lines| assert lines.any_include?('20/100 (..)') }
|
||||
tmux.send_keys 'C-c'
|
||||
tmux.until { |lines| refute lines.any_include?('20/100 (..)') }
|
||||
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 }
|
||||
|
||||
Reference in New Issue
Block a user