summary refs log tree commit diff stats
path: root/lib/ui
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2019-01-14 21:11:33 -0500
committerDrew DeVault <sir@cmpwn.com>2019-01-14 21:11:33 -0500
commit0b37441f177a46d40aad55f4553fa844bd4dbf6d (patch)
tree0b35fe7f1ba580745bf9ee2cbe371e79a28f3149 /lib/ui
parent8492a21a51c107f743a32231746bf5d38e9b1ccd (diff)
downloadaerc-0b37441f177a46d40aad55f4553fa844bd4dbf6d.tar.gz
Make repeated invalidations more efficient
Diffstat (limited to 'lib/ui')
-rw-r--r--lib/ui/ui.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/ui/ui.go b/lib/ui/ui.go
index 8a390f3..8fabf59 100644
--- a/lib/ui/ui.go
+++ b/lib/ui/ui.go
@@ -78,6 +78,16 @@ func (state *UI) Tick() bool {
 		}
 		state.Content.Event(event)
 	case <-state.invalidations:
+		for {
+			// Flush any other pending invalidations
+			select {
+			case <-state.invalidations:
+				break
+			default:
+				goto done
+			}
+		}
+	done:
 		state.Content.Draw(state.ctx)
 		state.screen.Show()
 	default:
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239