mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-15 10:05:14 +00:00
fix(tui): Strip OSC 8 hyperlink sequences in visibleWidth (#396)
This commit is contained in:
parent
209d95870e
commit
d97a96493c
1 changed files with 3 additions and 0 deletions
|
|
@ -108,7 +108,10 @@ export function visibleWidth(str: string): number {
|
|||
clean = clean.replace(/\t/g, " ");
|
||||
}
|
||||
if (clean.includes("\x1b")) {
|
||||
// Strip SGR codes (\x1b[...m) and cursor codes (\x1b[...G/K/H/J)
|
||||
clean = clean.replace(/\x1b\[[0-9;]*[mGKHJ]/g, "");
|
||||
// Strip OSC 8 hyperlinks: \x1b]8;;URL\x07 and \x1b]8;;\x07
|
||||
clean = clean.replace(/\x1b\]8;;[^\x07]*\x07/g, "");
|
||||
}
|
||||
|
||||
// Calculate width
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue