Keep the spinner spinning even when the source stream is idle
This commit is contained in:
parent
fe4e452d68
commit
d261c36cde
@ -197,6 +197,7 @@ func NewTerminal(opts *Options, eventBox *util.EventBox) *Terminal {
|
||||
printQuery: opts.PrintQuery,
|
||||
history: opts.History,
|
||||
cycle: opts.Cycle,
|
||||
reading: true,
|
||||
merger: EmptyMerger,
|
||||
selected: make(map[uint32]selectedItem),
|
||||
reqBox: util.NewEventBox(),
|
||||
@ -630,6 +631,20 @@ func (t *Terminal) Loop() {
|
||||
t.reqBox.Set(reqRedraw, nil)
|
||||
}
|
||||
}()
|
||||
|
||||
// Keep the spinner spinning
|
||||
go func() {
|
||||
for {
|
||||
t.mutex.Lock()
|
||||
reading := t.reading
|
||||
t.mutex.Unlock()
|
||||
if !reading {
|
||||
break
|
||||
}
|
||||
time.Sleep(spinnerDuration)
|
||||
t.reqBox.Set(reqInfo, nil)
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
exit := func(code int) {
|
||||
|
Loading…
Reference in New Issue
Block a user