summary refs log tree commit diff stats
path: root/lib/ui
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ui')
-rw-r--r--lib/ui/interfaces.go9
-rw-r--r--lib/ui/ui.go2
2 files changed, 7 insertions, 4 deletions
diff --git a/lib/ui/interfaces.go b/lib/ui/interfaces.go
index d27afe2..0cdffc1 100644
--- a/lib/ui/interfaces.go
+++ b/lib/ui/interfaces.go
@@ -4,12 +4,15 @@ import (
 	"github.com/gdamore/tcell"
 )
 
+// Drawable is a UI component that can draw. Unless specified, all methods must
+// only be called from a single goroutine, the UI goroutine.
 type Drawable interface {
-	// Called when this renderable should draw itself
+	// Called when this renderable should draw itself.
 	Draw(ctx *Context)
-	// Specifies a function to call when this cell needs to be redrawn
+	// Specifies a function to call when this cell needs to be redrawn. The
+	// callback may be called in any goroutine.
 	OnInvalidate(callback func(d Drawable))
-	// Invalidates the drawable
+	// Invalidates the drawable. This can be called from any goroutine.
 	Invalidate()
 }
 
diff --git a/lib/ui/ui.go b/lib/ui/ui.go
index 9d9a5da..91a26da 100644
--- a/lib/ui/ui.go
+++ b/lib/ui/ui.go
@@ -10,7 +10,7 @@ import (
 
 type UI struct {
 	Content DrawableInteractive
-	exit    atomic.Value
+	exit    atomic.Value // bool
 	ctx     *Context
 	screen  tcell.Screen
 
b45a7e15b28a979d0ccfce5c202859ba'>^
c83dca9c ^
c8998b51 ^




c83dca9c ^



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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151