package statview import ( "fmt" "io" "strings" ) func clearEOL(w io.Writer) { w.Write([]byte{0x1b, 0x5b, 0x4b}) } func goUp(w io.Writer) { w.Write([]byte{0x1b, 0x5b, 0x41}) } func (v *View[K]) print() { for i := 0; i < v.lastLineAmount; i++ { goUp(v.writer) clearEOL(v.writer) } lineAmount := 0 for _, task := range v.tasks { if report, ok := v.lastReports[task]; ok { lineAmount += len(strings.Split(report.Text, "\n")) fmt.Fprintln(v.writer, report.Text) } } v.lastLineAmount = lineAmount }