m/fzf
1
0
mirror of https://github.com/junegunn/fzf.git synced 2025-11-15 06:43:47 -05:00

--preview-window 0,hidden should not execute the preview command

Until `toggle-preview` action is triggered

Fix #3149
This commit is contained in:
Junegunn Choi
2023-01-30 21:39:18 +09:00
parent 0f4af38457
commit fccab60a5c
3 changed files with 51 additions and 69 deletions

View File

@@ -1244,6 +1244,8 @@ func (t *Terminal) resizeWindows(forcePreview bool) {
}
}
resizePreviewWindows(&t.previewOpts)
} else {
t.activePreviewOpts = &t.previewOpts
}
// Without preview window
@@ -2279,7 +2281,7 @@ func (t *Terminal) mayNeedPreviewWindow() bool {
// Check if previewer is currently in action (invisible previewer with size 0 or visible previewer)
func (t *Terminal) isPreviewEnabled() bool {
return t.hasPreviewer() && t.previewer.enabled && (!t.previewOpts.Visible() || t.pwindow != nil)
return t.hasPreviewer() && t.previewer.enabled && (!t.previewOpts.Visible() && !t.previewOpts.hidden || t.pwindow != nil)
}
func (t *Terminal) hasPreviewWindow() bool {
@@ -2866,11 +2868,7 @@ func (t *Terminal) Loop() {
return false
case actTogglePreview:
if t.hasPreviewer() {
if t.activePreviewOpts != nil {
t.activePreviewOpts.Toggle()
} else if !t.previewOpts.Visible() {
t.previewer.enabled = !t.previewer.enabled
}
t.activePreviewOpts.Toggle()
updatePreviewWindow(false)
if t.isPreviewEnabled() {
valid, list := t.buildPlusList(t.previewOpts.command, false, false)