]> git.lizzy.rs Git - micro.git/blobdiff - internal/screen/screen.go
Don't block when redraw channel becomes full
[micro.git] / internal / screen / screen.go
index f9ab1bd8878dd6a7ca29140aaf3e98f2139ea24d..f601af1cc6f01cc9c45af2d7df9a02c08412ba3a 100644 (file)
@@ -37,7 +37,11 @@ func Unlock() {
 
 // Redraw schedules a redraw with the draw channel
 func Redraw() {
-       DrawChan <- true
+       select {
+       case DrawChan <- true:
+       default:
+               // channel is full
+       }
 }
 
 type screenCell struct {
@@ -118,7 +122,7 @@ func TempStart(screenWasNil bool) {
 
 // Init creates and initializes the tcell screen
 func Init() {
-       DrawChan = make(chan bool, 8)
+       DrawChan = make(chan bool)
 
        // Should we enable true color?
        truecolor := os.Getenv("MICRO_TRUECOLOR") == "1"