MCPcopy
hub / github.com/docker/compose / maxBeforeStatusWidth

Function maxBeforeStatusWidth

cmd/display/tty.go:448–458  ·  view source on GitHub ↗

maxBeforeStatusWidth computes the maximum width before statusPad across all lines. This is: space(1) + spinner(1) + prefix + space(1) + taskID + progress

(lines []lineData)

Source from the content-addressed store, hash-verified

446// maxBeforeStatusWidth computes the maximum width before statusPad across all lines.
447// This is: space(1) + spinner(1) + prefix + space(1) + taskID + progress
448func maxBeforeStatusWidth(lines []lineData) int {
449 var maxWidth int
450 for i := range lines {
451 l := &lines[i]
452 width := 3 + lenAnsi(l.prefix) + utf8.RuneCountInString(l.taskID) + lenAnsi(l.progress)
453 if width > maxWidth {
454 maxWidth = width
455 }
456 }
457 return maxWidth
458}
459
460// computeOverflow calculates how many characters the widest line exceeds the terminal width.
461// Returns 0 or negative if all lines fit.

Callers 1

adjustLineWidthMethod · 0.85

Calls 1

lenAnsiFunction · 0.70

Tested by

no test coverage detected