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

No support for the newer colon (":") seperated SGR sequences #59

Open
Mani4D46 opened this issue Nov 29, 2024 · 1 comment
Open

No support for the newer colon (":") seperated SGR sequences #59

Mani4D46 opened this issue Nov 29, 2024 · 1 comment

Comments

@Mani4D46
Copy link

Mani4D46 commented Nov 29, 2024

from wezterm docs:

SGR sequences are of the form CSI DIGITS [; DIGITS ]+ m. That is, any number of semicolon separated numbers, terminated by the m codepoint. There are a handful of slightly more modern sequences that use colon : codepoints to encode additional context.

The colon is also used as an alternative to the semicolon separation method, take a look at this example on wezterm docs.

@Mani4D46
Copy link
Author

Mani4D46 commented Nov 29, 2024

Some tests done in python to replace every escape sequence to '[ESC]':

Using colons

>>> pattern = "[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))|(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"
>>> re.sub(pattern, '[ESC]', '\x1b[1:2m')
'[ESC]:2m'

Using semicolons

>>> re.sub(pattern, '[ESC]', '\x1b[1;2m')
'[ESC]'

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

No branches or pull requests

1 participant