mirror of
https://github.com/Llewellynvdm/fzf.git
synced 2024-12-01 09:13:55 +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
|
reqRedrawPreviewLabel
|
||||||
reqClose
|
reqClose
|
||||||
reqPrintQuery
|
reqPrintQuery
|
||||||
|
reqPreviewReady
|
||||||
reqPreviewEnqueue
|
reqPreviewEnqueue
|
||||||
reqPreviewDisplay
|
reqPreviewDisplay
|
||||||
reqPreviewRefresh
|
reqPreviewRefresh
|
||||||
@ -3469,6 +3470,7 @@ func (t *Terminal) Loop() error {
|
|||||||
go func() {
|
go func() {
|
||||||
var version int64
|
var version int64
|
||||||
stop := false
|
stop := false
|
||||||
|
t.previewBox.WaitFor(reqPreviewReady)
|
||||||
for {
|
for {
|
||||||
var items []*Item
|
var items []*Item
|
||||||
var commandTemplate string
|
var commandTemplate string
|
||||||
@ -3497,6 +3499,9 @@ func (t *Terminal) Loop() error {
|
|||||||
if stop {
|
if stop {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
if items == nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
version++
|
version++
|
||||||
// We don't display preview window if no match
|
// We don't display preview window if no match
|
||||||
if items[0] != nil {
|
if items[0] != nil {
|
||||||
@ -3738,6 +3743,9 @@ func (t *Terminal) Loop() error {
|
|||||||
t.printHeader()
|
t.printHeader()
|
||||||
case reqActivate:
|
case reqActivate:
|
||||||
t.suppress = false
|
t.suppress = false
|
||||||
|
if t.hasPreviewer() {
|
||||||
|
t.previewBox.Set(reqPreviewReady, nil)
|
||||||
|
}
|
||||||
case reqRedrawBorderLabel:
|
case reqRedrawBorderLabel:
|
||||||
t.printLabel(t.border, t.borderLabel, t.borderLabelOpts, t.borderLabelLen, t.borderShape, true)
|
t.printLabel(t.border, t.borderLabel, t.borderLabelOpts, t.borderLabelLen, t.borderShape, true)
|
||||||
case reqRedrawPreviewLabel:
|
case reqRedrawPreviewLabel:
|
||||||
|
Loading…
Reference in New Issue
Block a user