From 21a1977c3f78a207f3d05c61c963f345c20fbf40 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Sun, 17 May 2026 10:48:43 +0900 Subject: [PATCH] Add regression test for FZF_KEY vs synthetic events --- test/test_core.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/test_core.rb b/test/test_core.rb index cad5f26b..56a3f555 100644 --- a/test/test_core.rb +++ b/test/test_core.rb @@ -1454,6 +1454,18 @@ class TestCore < TestInteractive end end + def test_fzf_key_ignores_synthetic_events + tmux.send_keys %(seq 100 | fzf --bind 'every(0.2):transform-prompt(echo "[$FZF_KEY]> ")'), :Enter + tmux.until { |lines| assert_equal 100, lines.match_count } + # No user input yet: prompt should show empty FZF_KEY + tmux.until { |lines| assert_includes lines[-1], '[]>' } + tmux.send_keys 'x' + tmux.until { |lines| assert_includes lines[-1], '[x]>' } + # every() ticks shouldn't overwrite FZF_KEY + sleep 1 + assert_includes tmux.capture[-1], '[x]>' + end + def test_labels_center tmux.send_keys 'echo x | fzf --border --border-label foobar --preview : --preview-label barfoo --bind "space:change-border-label(foobarfoo)+change-preview-label(barfoobar),enter:transform-border-label(echo foo{}foo)+transform-preview-label(echo bar{}bar)"', :Enter tmux.until do