cleanup TUI lines after switching to "compact" mode

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
Nicolas De Loof 2023-01-25 11:29:56 +01:00 committed by Nicolas De loof
parent d47f0f31c2
commit aa31387355
1 changed files with 7 additions and 2 deletions

View File

@ -118,7 +118,7 @@ func (w *ttyWriter) printTailEvents() {
} }
} }
func (w *ttyWriter) print() { func (w *ttyWriter) print() { //nolint:gocyclo
w.mtx.Lock() w.mtx.Lock()
defer w.mtx.Unlock() defer w.mtx.Unlock()
if len(w.eventIDs) == 0 { if len(w.eventIDs) == 0 {
@ -182,7 +182,12 @@ func (w *ttyWriter) print() {
} }
} }
} }
for i := numLines; i < w.numLines; i++ {
if numLines < goterm.Height()-2 {
fmt.Fprintln(w.out, strings.Repeat(" ", terminalWidth))
numLines++
}
}
w.numLines = numLines w.numLines = numLines
} }