StripOSC8Hyperlinks removes OSC 8 hyperlink sequences and keeps only the visible link text. OSC 8 format: \033]8;;URL\033\\LINK_TEXT\033]8;;\033\\ Only LINK_TEXT is visible in the terminal, so we keep only that part.
(s string)
| 18 | // OSC 8 format: \033]8;;URL\033\\LINK_TEXT\033]8;;\033\\ |
| 19 | // Only LINK_TEXT is visible in the terminal, so we keep only that part. |
| 20 | func StripOSC8Hyperlinks(s string) string { |
| 21 | // Replace OSC 8 hyperlinks with just the link text (capture group 1) |
| 22 | return osc8Regex.ReplaceAllString(s, "$1") |
| 23 | } |
| 24 | |
| 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. |
no outgoing calls
searching dependent graphs…