chalk / ansi-regex

Regular expression for matching ANSI escape codes
MIT License
184 stars 79 forks source link

Fix: Handle all valid ST characters #58

Closed llimllib closed 1 month ago

llimllib commented 2 months ago

There is no OSC spec, but it appears that most emulators accept 0x1B 0x5C as an ST character, with 0x07 and 0x9C as alternatives with a bit less support.

This PR updates the regular expression to match all three of 0x1b 0x5C, 0x07, and 0x9C as an ST character, and updates the test file accordingly.

Choices I made, any of which I'm happy to change if you prefer:

Closes https://github.com/chalk/ansi-regex/issues/56

llimllib commented 2 months ago

The tests have passed, but I think that tsd is failing on irrelevant things that I don't understand?

sindresorhus commented 1 month ago

I did not pull out the ST character part of the regular expression into a variable, though I would prefer that

Yeah, do that.

llimllib commented 1 month ago

done, and merged main too. Thanks for fixing that up