mirror of
https://github.com/junegunn/fzf.git
synced 2025-08-01 04:32:05 -07:00
Add bg-cancel action to ignore running background transforms
Close #4430 Example: # Implement popup that disappears after 1 second # * Use footer as the popup # * Use `bell` to ring the terminal bell # * Use `bg-transform-footer` to clear the footer after 1 second # * Use `bg-cancel` to ignore currently running background transform actions fzf --multi --list-border \ --bind 'enter:execute-silent(echo -n {+} | pbcopy)+bell' \ --bind 'enter:+transform-footer(echo Copied {} to clipboard)' \ --bind 'enter:+bg-cancel+bg-transform-footer(sleep 1)'
This commit is contained in:
@@ -1964,4 +1964,21 @@ class TestCore < TestInteractive
|
||||
elapsed = Time.now - time
|
||||
assert elapsed < 2
|
||||
end
|
||||
|
||||
def test_bg_cancel
|
||||
tmux.send_keys %(seq 0 1 | #{FZF} --bind 'space:bg-cancel+bg-transform-header(sleep {}; echo [{}])'), :Enter
|
||||
tmux.until { assert_equal 2, it.match_count }
|
||||
tmux.send_keys '1'
|
||||
tmux.until { assert_equal 1, it.match_count }
|
||||
tmux.send_keys :Space
|
||||
tmux.send_keys :BSpace
|
||||
tmux.until { assert_equal 2, it.match_count }
|
||||
tmux.send_keys :Space
|
||||
tmux.until { |lines| assert lines.any_include?('[0]') }
|
||||
sleep 2
|
||||
tmux.until do |lines|
|
||||
assert lines.any_include?('[0]')
|
||||
refute lines.any_include?('[1]')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user