From 401a5fd5ff0e509a4ea56c9dba567e17be6c494f Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Sun, 18 Sep 2016 04:45:21 +0900 Subject: [PATCH] Printable character in --expect set should not affect --print-query --- src/terminal.go | 5 +++-- test/test_go.rb | 9 +++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/terminal.go b/src/terminal.go index fa758e9..2a02ff8 100644 --- a/src/terminal.go +++ b/src/terminal.go @@ -1079,8 +1079,9 @@ func (t *Terminal) Loop() { for key, ret := range t.expect { if keyMatch(key, event) { t.pressed = ret - req(reqClose) - break + t.reqBox.Set(reqClose, nil) + t.mutex.Unlock() + return } } diff --git a/test/test_go.rb b/test/test_go.rb index 2c01818..ff4b173 100644 --- a/test/test_go.rb +++ b/test/test_go.rb @@ -452,6 +452,15 @@ class TestGoFZF < TestBase assert_equal ['55', 'alt-z', '55'], readonce.split($/) end + def test_expect_printable_character_print_query + tmux.send_keys "seq 1 100 | #{fzf '--expect=z --print-query'}", :Enter + tmux.until { |lines| lines[-2].include? '100/100' } + tmux.send_keys '55' + tmux.until { |lines| lines[-2].include? '1/100' } + tmux.send_keys 'z' + assert_equal ['55', 'z', '55'], readonce.split($/) + end + def test_expect_print_query_select_1 tmux.send_keys "seq 1 100 | #{fzf '-q55 -1 --expect=alt-z --print-query'}", :Enter assert_equal ['55', '', '55'], readonce.split($/)