Skip child events when printer events > terminal height

Signed-off-by: Laura Brehm <laurabrehm@hey.com>
This commit is contained in:
Laura Brehm 2023-01-12 01:22:58 +01:00 committed by Nicolas De loof
parent 4ad87463c5
commit 69a09624c9
1 changed files with 7 additions and 0 deletions

View File

@ -157,6 +157,10 @@ func (w *ttyWriter) print() {
}
}
skipChildEvents := false
if len(w.eventIDs) > goterm.Height()-1 {
skipChildEvents = true
}
numLines := 0
for _, v := range w.eventIDs {
event := w.events[v]
@ -169,6 +173,9 @@ func (w *ttyWriter) print() {
for _, v := range w.eventIDs {
ev := w.events[v]
if ev.ParentID == event.ID {
if skipChildEvents {
continue
}
line := lineText(ev, " ", terminalWidth, statusPadding, runtime.GOOS != "windows")
fmt.Fprint(w.out, line)
numLines++