MCPcopy Create free account
hub / github.com/docker/cli / Width

Function Width

internal/tui/count.go:28–30  ·  view source on GitHub ↗

Width returns the width of the string, ignoring ANSI escape codes. Not all ANSI escape codes are supported yet.

(s string)

Source from the content-addressed store, hash-verified

26// Width returns the width of the string, ignoring ANSI escape codes.
27// Not all ANSI escape codes are supported yet.
28func Width(s string) int {
29 return runewidth.StringWidth(cleanANSI(s))
30}
31
32// Ellipsis truncates a string to a given number of runes with an ellipsis at the end.
33// It tries to persist the ANSI escape sequences.

Callers 1

printNoteWithOptionsMethod · 0.85

Calls 1

cleanANSIFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…