From 821fc9feed569149e0fd63b3e7d078b8a601bd37 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Wed, 20 Jul 2022 12:29:45 +0900 Subject: [PATCH] Fix failing test case --- src/options.go | 1 + src/terminal.go | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/options.go b/src/options.go index 93178df..cb1b7ef 100644 --- a/src/options.go +++ b/src/options.go @@ -1247,6 +1247,7 @@ func parsePreviewWindow(opts *previewOpts, input string) { if len(alternative) > 0 { alternativeOpts := *opts opts.alternative = &alternativeOpts + opts.alternative.hidden = false opts.alternative.alternative = nil parsePreviewWindow(opts.alternative, alternative) } diff --git a/src/terminal.go b/src/terminal.go index 96bb641..bce7137 100644 --- a/src/terminal.go +++ b/src/terminal.go @@ -877,9 +877,6 @@ func (t *Terminal) resizeWindows() { if previewVisible { var resizePreviewWindows func(previewOpts previewOpts) resizePreviewWindows = func(previewOpts previewOpts) { - if previewOpts.hidden { - return - } hasThreshold := previewOpts.threshold > 0 && previewOpts.alternative != nil createPreviewWindow := func(y int, x int, w int, h int) { pwidth := w @@ -930,7 +927,9 @@ func (t *Terminal) resizeWindows() { case posUp, posDown: pheight := calculateSize(height, previewOpts.size, minHeight, minPreviewHeight, verticalPad) if hasThreshold && pheight < previewOpts.threshold { - resizePreviewWindows(*previewOpts.alternative) + if !previewOpts.alternative.hidden { + resizePreviewWindows(*previewOpts.alternative) + } return } if previewOpts.position == posUp { @@ -945,8 +944,9 @@ func (t *Terminal) resizeWindows() { case posLeft, posRight: pwidth := calculateSize(width, previewOpts.size, minWidth, 5, 4) if hasThreshold && pwidth < previewOpts.threshold { - fmt.Println("Alternative", (*previewOpts.alternative).position == posDown) - resizePreviewWindows(*previewOpts.alternative) + if !previewOpts.alternative.hidden { + resizePreviewWindows(*previewOpts.alternative) + } return } if previewOpts.position == posLeft {