summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2015-06-18 00:42:38 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2015-06-18 00:42:38 +0900
commitd261c36cde9ef933d008e4cd7005497ad18f2158 (patch)
tree0851aefb7bafc3ef885742c5be61ab18a29ac7fe
parentfe4e452d68435aa5e288b5e6364862a5fc6551c0 (diff)
Keep the spinner spinning even when the source stream is idle
-rw-r--r--src/terminal.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/terminal.go b/src/terminal.go
index f2131959..aca8aad4 100644
--- a/src/terminal.go
+++ b/src/terminal.go
@@ -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) {