mirror of
https://github.com/Llewellynvdm/fzf.git
synced 2024-11-28 15:56:27 +00:00
Make sure preview command is not run before Terminal is ready
This commit is contained in:
parent
a2d0e8f233
commit
e28f5aa45b
@ -382,6 +382,7 @@ const (
|
||||
reqRedrawPreviewLabel
|
||||
reqClose
|
||||
reqPrintQuery
|
||||
reqPreviewReady
|
||||
reqPreviewEnqueue
|
||||
reqPreviewDisplay
|
||||
reqPreviewRefresh
|
||||
@ -3469,6 +3470,7 @@ func (t *Terminal) Loop() error {
|
||||
go func() {
|
||||
var version int64
|
||||
stop := false
|
||||
t.previewBox.WaitFor(reqPreviewReady)
|
||||
for {
|
||||
var items []*Item
|
||||
var commandTemplate string
|
||||
@ -3497,6 +3499,9 @@ func (t *Terminal) Loop() error {
|
||||
if stop {
|
||||
break
|
||||
}
|
||||
if items == nil {
|
||||
continue
|
||||
}
|
||||
version++
|
||||
// We don't display preview window if no match
|
||||
if items[0] != nil {
|
||||
@ -3738,6 +3743,9 @@ func (t *Terminal) Loop() error {
|
||||
t.printHeader()
|
||||
case reqActivate:
|
||||
t.suppress = false
|
||||
if t.hasPreviewer() {
|
||||
t.previewBox.Set(reqPreviewReady, nil)
|
||||
}
|
||||
case reqRedrawBorderLabel:
|
||||
t.printLabel(t.border, t.borderLabel, t.borderLabelOpts, t.borderLabelLen, t.borderShape, true)
|
||||
case reqRedrawPreviewLabel:
|
||||
|
Loading…
Reference in New Issue
Block a user