From 1ee40507ef41d89bf828e26221db42e21e13dc3c Mon Sep 17 00:00:00 2001 From: Kiyon Date: Mon, 5 Apr 2021 14:18:02 +0800 Subject: [PATCH] Add lock for updating width and height --- standard_renderer.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/standard_renderer.go b/standard_renderer.go index bdaf977..2c8a8ee 100644 --- a/standard_renderer.go +++ b/standard_renderer.go @@ -292,8 +292,10 @@ func (r *standardRenderer) insertBottom(lines []string, topBoundary, bottomBound func (r *standardRenderer) handleMessages(msg Msg) { switch msg := msg.(type) { case WindowSizeMsg: + r.mtx.Lock() r.width = msg.Width r.height = msg.Height + r.mtx.Unlock() case clearScrollAreaMsg: r.clearIgnoredLines()