diff --git a/cmd/micro/micro.go b/cmd/micro/micro.go index 19ab25d5..950e8888 100644 --- a/cmd/micro/micro.go +++ b/cmd/micro/micro.go @@ -278,8 +278,8 @@ func main() { // clear the drawchan so we don't redraw excessively // if someone requested a redraw before we started displaying - for len(screen.DrawChan) > 0 { - <-screen.DrawChan + for len(screen.DrawChan()) > 0 { + <-screen.DrawChan() } // wait for initial resize event @@ -334,7 +334,7 @@ func DoEvent() { } case <-shell.CloseTerms: case event = <-events: - case <-screen.DrawChan: + case <-screen.DrawChan(): } if action.InfoBar.HasPrompt { diff --git a/internal/screen/screen.go b/internal/screen/screen.go index f601af1c..19f9bd8c 100644 --- a/internal/screen/screen.go +++ b/internal/screen/screen.go @@ -21,9 +21,9 @@ var Screen tcell.Screen // The lock is necessary since the screen is polled on a separate thread var lock sync.Mutex -// DrawChan is a channel that will cause the screen to redraw when +// drawChan is a channel that will cause the screen to redraw when // written to even if no event user event has occurred -var DrawChan chan bool +var drawChan chan bool // Lock locks the screen lock func Lock() { @@ -38,12 +38,17 @@ func Unlock() { // Redraw schedules a redraw with the draw channel func Redraw() { select { - case DrawChan <- true: + case drawChan <- true: default: // channel is full } } +// DrawChan returns the draw channel +func DrawChan() chan bool { + return drawChan +} + type screenCell struct { x, y int r rune @@ -122,7 +127,7 @@ func TempStart(screenWasNil bool) { // Init creates and initializes the tcell screen func Init() { - DrawChan = make(chan bool) + drawChan = make(chan bool) // Should we enable true color? truecolor := os.Getenv("MICRO_TRUECOLOR") == "1"