Render preview window when the initial query fails to match

Only if preview template contains {q}

Fix #1452
Related #1307
This commit is contained in:
Junegunn Choi 2018-12-05 18:45:55 +09:00
parent d4ed955aee
commit 61feee690c
No known key found for this signature in database
GPG Key ID: 254BC280FEF9C627
2 changed files with 7 additions and 1 deletions

View File

@ -1533,7 +1533,7 @@ func (t *Terminal) Loop() {
go func() { go func() {
var focused *Item var focused *Item
var version int64 var version int64 = -1
for { for {
t.reqBox.Wait(func(events *util.Events) { t.reqBox.Wait(func(events *util.Events) {
defer events.Clear() defer events.Clear()

View File

@ -1427,6 +1427,12 @@ class TestGoFZF < TestBase
tmux.until { |lines| !lines[1].include?('foo') } tmux.until { |lines| !lines[1].include?('foo') }
end 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 def test_no_clear
tmux.send_keys "seq 10 | fzf --no-clear --inline-info --height 5 > #{tempname}", :Enter tmux.send_keys "seq 10 | fzf --no-clear --inline-info --height 5 > #{tempname}", :Enter
prompt = '> < 10/10' prompt = '> < 10/10'