From fb019d43bf17b264f45aba1f1b65cd5a39be0cff Mon Sep 17 00:00:00 2001 From: tyama711 Date: Sun, 2 Apr 2023 23:26:13 +0900 Subject: [PATCH] Fix a bug of height range with -1 or -0 (#3226) Fixed a bug that when both heightUnknown and deferred are true, deferred is not properly reset and the program terminates abnormally. Co-authored-by: Junegunn Choi --- src/core.go | 1 + test/test_go.rb | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/src/core.go b/src/core.go index 0545c48..a4751a5 100644 --- a/src/core.go +++ b/src/core.go @@ -219,6 +219,7 @@ func Run(opts *Options, version string, revision string) { determine := func(final bool) { if heightUnknown { if total >= maxFit || final { + deferred = false heightUnknown = false terminal.startChan <- fitpad{util.Min(total, maxFit), padHeight} } diff --git a/test/test_go.rb b/test/test_go.rb index 7f7d564..9285a07 100755 --- a/test/test_go.rb +++ b/test/test_go.rb @@ -2716,6 +2716,13 @@ class TestGoFZF < TestBase assert(lines.any? { _1.include?('only match') }) end end + + def test_height_range_with_exit_0 + tmux.send_keys "seq 10 | #{FZF} --height ~10% --exit-0", :Enter + tmux.until { |lines| assert_equal 10, lines.item_count } + tmux.send_keys :c + tmux.until { |lines| assert_equal 0, lines.match_count } + end end module TestShell