vadimdemedes / ink

🌈 React for interactive command-line apps
https://term.ink
MIT License
27.05k stars 607 forks source link

Ignore OSC ansi sequences when calculating line length #633

Open isaacs opened 1 year ago

isaacs commented 1 year ago

I thought to add hyperlinks to stack trace reporting in node-tap but the OSC ansi sequence makes ink think that it's a very long line, and wrap inappropriately, even though there are no visible characters printed.

Proposal: when calculating line length, ignore any strings matching /\x1b].*?\x1b\\/. This will prevent ink from including title setting sequences or hyperlinks in the length calculation.

vadimdemedes commented 12 months ago

Makes sense. I'd welcome a PR for this.

cakoose commented 11 months ago

@isaacs: Would your problem be solved if you used ink-link to render the hyperlink?