aboutsummaryrefslogtreecommitdiffstats
path: root/focus.go
diff options
context:
space:
mode:
authorSam Anthony <sam@samanthony.xyz>2024-01-23 22:03:23 -0500
committerSam Anthony <sam@samanthony.xyz>2024-01-23 22:03:23 -0500
commit74cf86d3bf324b497622a8ffb2d20399f620b23f (patch)
tree146014e91adef6f8c13d00cd575fd0e530e62665 /focus.go
parentfa3575ff99bfe62c50be56a124076735365438be (diff)
downloadvolute-74cf86d3bf324b497622a8ffb2d20399f620b23f.zip
graceful shutdown of goroutines
Diffstat (limited to 'focus.go')
-rw-r--r--focus.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/focus.go b/focus.go
index 331d232..5f19e6c 100644
--- a/focus.go
+++ b/focus.go
@@ -19,6 +19,14 @@ func NewFocus(rows []int) Focus {
return f
}
+func (f *Focus) Close() {
+ for i := range f.widgets {
+ for j := range f.widgets[i] {
+ close(f.widgets[i][j])
+ }
+ }
+}
+
func (f *Focus) Left() {
f.widgets[f.p.Y][f.p.X] <- false
if f.p.X <= 0 {