From 84a7499ae357bc3b3a82890d2e44d9c300af0c13 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Tue, 31 Mar 2015 20:52:16 +0900 Subject: [PATCH] Fix #172 - Print empty line when fzf with expect finished by -1 or -0 --- src/core.go | 3 +++ test/test_go.rb | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/src/core.go b/src/core.go index ebb7d66..204532b 100644 --- a/src/core.go +++ b/src/core.go @@ -216,6 +216,9 @@ func Run(options *Options) { if opts.PrintQuery { fmt.Println(opts.Query) } + if len(opts.Expect) > 0 { + fmt.Println() + } for i := 0; i < count; i++ { fmt.Println(val.Get(i).AsString()) } diff --git a/test/test_go.rb b/test/test_go.rb index adfc0d0..a47e422 100644 --- a/test/test_go.rb +++ b/test/test_go.rb @@ -452,6 +452,11 @@ class TestGoFZF < TestBase tmux.send_keys :Escape, :z assert_equal ['55', 'alt-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($/) + end end module TestShell