Add lock for updating width and height

This commit is contained in:
Kiyon 2021-04-05 14:18:02 +08:00 committed by Christian Muehlhaeuser
parent ab65f2391f
commit 1ee40507ef
1 changed files with 2 additions and 0 deletions

View File

@ -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()