From 61feee690c25487aab7613771cd75166d404273a Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Wed, 5 Dec 2018 18:45:55 +0900 Subject: [PATCH] Render preview window when the initial query fails to match Only if preview template contains {q} Fix #1452 Related #1307 --- src/terminal.go | 2 +- test/test_go.rb | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/terminal.go b/src/terminal.go index cae349dc..d0b2971e 100644 --- a/src/terminal.go +++ b/src/terminal.go @@ -1533,7 +1533,7 @@ func (t *Terminal) Loop() { go func() { var focused *Item - var version int64 + var version int64 = -1 for { t.reqBox.Wait(func(events *util.Events) { defer events.Clear() diff --git a/test/test_go.rb b/test/test_go.rb index c7758068..d22b8939 100755 --- a/test/test_go.rb +++ b/test/test_go.rb @@ -1427,6 +1427,12 @@ class TestGoFZF < TestBase tmux.until { |lines| !lines[1].include?('foo') } end + def test_preview_q_no_match_with_initial_query + tmux.send_keys %(: | #{FZF} --preview 'echo foo {q}{q}' --query foo), :Enter + tmux.until { |lines| lines.match_count == 0 } + tmux.until { |lines| lines[1].include?('foofoo') } + end + def test_no_clear tmux.send_keys "seq 10 | fzf --no-clear --inline-info --height 5 > #{tempname}", :Enter prompt = '> < 10/10'