Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to match links ended with \u001B rather than \u0007. #56

Closed
avivkeller opened this issue Jul 8, 2024 · 2 comments · Fixed by #58
Closed

Unable to match links ended with \u001B rather than \u0007. #56

avivkeller opened this issue Jul 8, 2024 · 2 comments · Fixed by #58

Comments

@avivkeller
Copy link

avivkeller commented Jul 8, 2024

ansi-regex cannot match link regexes that end in \u0001B, as the regex only allows \u0007.

Example: \x1b]8;;http://example.com/\x1b\\This is a link\x1b]8;;\x1b\\ hello
Reference: nodejs/node#53697

@hildjj
Copy link

hildjj commented Aug 1, 2024

For anyone digging into this, "OSC" is an "Operating System Command". One reference I've found is from Microsoft, which claims:

As OSC sequences, they are ended with a String Terminator represented as and
transmitted with ESC \ (0x1B 0x5C). BEL (0x7) may be used instead as the terminator,
but the longer form is preferred.

So the bug should probably read "cannot match link regexes that end in \u0001B\u005c".

I've verified that iTerm2 at least does accept the sample string, so this isn't just a Microsoft thing.

@llimllib
Copy link
Contributor

llimllib commented Sep 4, 2024

wiki says that 0x9C and 0x1B 0x5C (ESC ) are both standard STs and should be supported; I wish there were a real spec but it seems like practice is all we have here.

The OSC8 spec uses 0x1B 0x5C, for whatever that's worth.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants