diff --git a/cmd/display/tty_layout.go b/cmd/display/tty_layout.go index 08da3df36..9f6622611 100644 --- a/cmd/display/tty_layout.go +++ b/cmd/display/tty_layout.go @@ -65,7 +65,8 @@ const ( // layoutFrame renders the whole progress block, one string per terminal row. func layoutFrame(t *taskTree, operation string, o layoutOpts) []string { done, total := t.counts() - lines := []string{fmt.Sprintf("[+] %s %d/%d", operation, done, total)} + header := fmt.Sprintf("[+] %s %d/%d", operation, done, total) + lines := []string{renderSegs([]seg{{text: header}}, o.width)} rows := buildRows(t, o) maxRows := max(o.height-2, 1) diff --git a/cmd/display/tty_test.go b/cmd/display/tty_test.go index 49b3c081b..0945ee8e6 100644 --- a/cmd/display/tty_test.go +++ b/cmd/display/tty_test.go @@ -116,7 +116,9 @@ func adversarialEvents() []api.Resource { } func TestTerm_NoLineEverExceedsTerminalWidth(t *testing.T) { - for _, width := range []int{20, 30, 40, 60, 80, 120} { + // 8 and 12 exercise the degenerate widths where even the "[+] op N/M" + // header must be clipped rather than allowed to wrap + for _, width := range []int{8, 12, 20, 30, 40, 60, 80, 120} { t.Run(fmt.Sprintf("width=%d", width), func(t *testing.T) { w, buf, _ := newTermWriter(width, 40) feed(w, adversarialEvents()...)