Skip to content

add conpty workarounds mode #200

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

neurocyte
Copy link
Contributor

conpty's grasp of ansi escape codes is a little shaky (at best). This PR adds a flag to libvaxis to enable conpty specific ansi sequence workarounds.

There is just one hack (so far), a version of ul_rgb (called ul_rgb_conpty) that contains an extra colon. Without the extra colon in ul_rgb conpty gets it's internal state really confused and fails to parse ansi sequences that follow this one causing chaos.

@@ -89,6 +89,7 @@ pub const ul_indexed = "\x1b[58:5:{d}m";
pub const fg_rgb = "\x1b[38:2:{d}:{d}:{d}m";
pub const bg_rgb = "\x1b[48:2:{d}:{d}:{d}m";
pub const ul_rgb = "\x1b[58:2:{d}:{d}:{d}m";
pub const ul_rgb_conpty = "\x1b[58:2::{d}:{d}:{d}m";
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of a conpty workaround, I think it's safe to add this to the standard colon delimited versions. Terminals that support the colon should also be aware that an empty param can exist there.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I felt like documenting that omitting this one extra colon totally breaks conpty for no apparent reason. Some overly tidy programmer (aka me) will likely be tempted to "clean-up" the extra empty param if it's not clear why it's there.

How about we just default conpty_hacks to true instead?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm open to that but I think instead of calling it a hack we should call it something like *_rgb_strict. xterm+direct even has the extra semicolon as part of the setaf vale (ref).

Then we could do three levels of conformance: strict, loose, legacy.

Do the FG / BG sequences break - or just the UL one?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do the FG / BG sequences break - or just the UL one?

It's just UL.

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 this pull request may close these issues.

2 participants