Fix dropped redraw events (#1675)
If screen.Redraw() is called very quickly after a key or mouse event, it may send the redraw event while micro is not waiting for it but still processing the key or mouse event. Since drawChan is non-buffered and at the same time non-blocking, this redraw event will be simply lost, so the screen content will not be up-to-date.
This commit is contained in:
parent
bd43a44194
commit
c5b0c2d41f
2 changed files with 4 additions and 1 deletions
|
@ -363,6 +363,9 @@ func DoEvent() {
|
|||
case <-shell.CloseTerms:
|
||||
case event = <-events:
|
||||
case <-screen.DrawChan():
|
||||
for len(screen.DrawChan()) > 0 {
|
||||
<-screen.DrawChan()
|
||||
}
|
||||
}
|
||||
|
||||
if action.InfoBar.HasPrompt {
|
||||
|
|
|
@ -127,7 +127,7 @@ func TempStart(screenWasNil bool) {
|
|||
|
||||
// Init creates and initializes the tcell screen
|
||||
func Init() {
|
||||
drawChan = make(chan bool)
|
||||
drawChan = make(chan bool, 8)
|
||||
|
||||
// Should we enable true color?
|
||||
truecolor := os.Getenv("MICRO_TRUECOLOR") == "1"
|
||||
|
|
Loading…
Reference in a new issue