summary refs log tree commit diff stats
path: root/widgets/spinner.go
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2019-03-14 21:37:00 -0400
committerDrew DeVault <sir@cmpwn.com>2019-03-14 21:37:00 -0400
commit0f8b7a1203309ebec0dc78baf3f195671eadac2d (patch)
treefce6d8148cdbfa5ecfb2030a902f5a0763bb3643 /widgets/spinner.go
parentb3896476a0e6978c0d7f6fedfb64588934a78f1e (diff)
downloadaerc-0f8b7a1203309ebec0dc78baf3f195671eadac2d.tar.gz
Lay out message list widget basic design
Diffstat (limited to 'widgets/spinner.go')
-rw-r--r--widgets/spinner.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/widgets/spinner.go b/widgets/spinner.go
index 2e7e367..812fb2c 100644
--- a/widgets/spinner.go
+++ b/widgets/spinner.go
@@ -36,6 +36,10 @@ func NewSpinner() *Spinner {
 }
 
 func (s *Spinner) Start() {
+	if s.IsRunning() {
+		return
+	}
+
 	s.frame = 0
 	go func() {
 		for {
@@ -54,6 +58,10 @@ func (s *Spinner) Start() {
 }
 
 func (s *Spinner) Stop() {
+	if !s.IsRunning() {
+		return
+	}
+
 	s.stop <- nil
 	s.frame = -1
 	s.Invalidate()
@@ -64,6 +72,10 @@ func (s *Spinner) IsRunning() bool {
 }
 
 func (s *Spinner) Draw(ctx *ui.Context) {
+	if !s.IsRunning() {
+		return
+	}
+
 	ctx.Fill(0, 0, ctx.Width(), ctx.Height(), ' ', tcell.StyleDefault)
 	col := ctx.Width()/2 - len(frames[0])/2 + 1
 	ctx.Printf(col, 0, tcell.StyleDefault, "%s", frames[s.frame])
00 updated pydoc pages' href='/akspecs/ranger/commit/doc/ranger.container.environment.html?h=v1.8.0&id=f07bb12fc5c59430e995a64956b36331ce3629b9'>f07bb12f ^
34a60763 ^
f07bb12f ^

















34a60763 ^

f07bb12f ^











34a60763 ^

f07bb12f ^





























34a60763 ^
f07bb12f ^


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130