瀏覽代碼

cleanup TUI lines after switching to "compact" mode

Signed-off-by: Nicolas De Loof <[email protected]>
Nicolas De Loof 2 年之前
父節點
當前提交
aa31387355
共有 1 個文件被更改,包括 7 次插入2 次删除
  1. 7 2
      pkg/progress/tty.go

+ 7 - 2
pkg/progress/tty.go

@@ -118,7 +118,7 @@ func (w *ttyWriter) printTailEvents() {
 	}
 }
 
-func (w *ttyWriter) print() {
+func (w *ttyWriter) print() { //nolint:gocyclo
 	w.mtx.Lock()
 	defer w.mtx.Unlock()
 	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
 }