MCPcopy
hub / github.com/pterm/pterm / RemoveEscapeCodes

Function RemoveEscapeCodes

internal/utils.go:27–31  ·  view source on GitHub ↗

RemoveEscapeCodes removes both OSC 8 hyperlinks and ANSI color codes from a string. This should be used when calculating the visible width of a string for rendering.

(s string)

Source from the content-addressed store, hash-verified

25// RemoveEscapeCodes removes both OSC 8 hyperlinks and ANSI color codes from a string.
26// This should be used when calculating the visible width of a string for rendering.
27func RemoveEscapeCodes(s string) string {
28 // Strip OSC 8 hyperlinks first, then color codes
29 s = StripOSC8Hyperlinks(s)
30 return color.ClearCode(s)
31}

Callers 4

RemoveColorFromStringFunction · 0.92
CenterTextFunction · 0.85
ReturnLongestLineFunction · 0.85
GetStringMaxWidthFunction · 0.85

Calls 1

StripOSC8HyperlinksFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…