From cc50040e6da4cc59f9da38501c72270b9825d446 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Tue, 23 Dec 2025 15:40:37 +0100 Subject: [PATCH] Move SetContentLineCount into OverwriteLinesAndClearEverythingElse Calling it separately beforehand is not concurrency safe; we need both to happen when the writeMutex is locked. --- view.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/view.go b/view.go index 87f61eeb..0d0b19ef 100644 --- a/view.go +++ b/view.go @@ -1728,10 +1728,12 @@ func (v *View) OverwriteLines(y int, content string) { } // only call this function if you don't care where v.wx and v.wy end up -func (v *View) OverwriteLinesAndClearEverythingElse(y int, content string) { +func (v *View) OverwriteLinesAndClearEverythingElse(lineCount int, y int, content string) { v.writeMutex.Lock() defer v.writeMutex.Unlock() + v.setContentLineCount(lineCount) + v.overwriteLines(y, content) for i := 0; i < y; i += 1 { @@ -1743,7 +1745,7 @@ func (v *View) OverwriteLinesAndClearEverythingElse(y int, content string) { } } -func (v *View) SetContentLineCount(lineCount int) { +func (v *View) setContentLineCount(lineCount int) { if lineCount > 0 { v.makeWriteable(0, lineCount-1) }