]> git.lizzy.rs Git - micro.git/commitdiff
Ensure screen cannot draw during a term prompt
authorZachary Yedidia <zyedidia@gmail.com>
Wed, 17 Aug 2022 05:07:41 +0000 (22:07 -0700)
committerZachary Yedidia <zyedidia@gmail.com>
Wed, 17 Aug 2022 05:07:41 +0000 (22:07 -0700)
Fixes #2528

cmd/micro/micro.go
internal/screen/screen.go

index e05902440ba2148c20459edb7d343c1eb1b3b122..4af1d295e4d354d497f54d61b8813f62404bef75 100644 (file)
@@ -388,6 +388,7 @@ func DoEvent() {
        var event tcell.Event
 
        // Display everything
+       screen.DrawLock.Lock()
        screen.Screen.Fill(' ', config.DefStyle)
        screen.Screen.HideCursor()
        action.Tabs.Display()
@@ -397,6 +398,7 @@ func DoEvent() {
        action.MainTab().Display()
        action.InfoBar.Display()
        screen.Screen.Show()
+       screen.DrawLock.Unlock()
 
        // Check for new events
        select {
index 967e8617e1c9ab7d9f9b4dbd3915323007af721d..0f1cd64b0ab57afe8a0ed87c492cc0621804c531 100644 (file)
@@ -24,6 +24,7 @@ var Events chan (tcell.Event)
 
 // The lock is necessary since the screen is polled on a separate thread
 var lock sync.Mutex
+var DrawLock sync.Mutex
 
 // drawChan is a channel that will cause the screen to redraw when
 // written to even if no event user event has occurred
@@ -120,6 +121,7 @@ func TempFini() bool {
        if !screenWasNil {
                Screen.Fini()
                Lock()
+               DrawLock.Lock()
                Screen = nil
        }
        return screenWasNil
@@ -130,6 +132,7 @@ func TempStart(screenWasNil bool) {
        if !screenWasNil {
                Init()
                Unlock()
+               DrawLock.Unlock()
        }
 }