vadimdemedes/ink

Ignore OSC ansi sequences when calculating line length

isaacs opened this issue · 2 comments

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.

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

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