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

Fix for ANSI color codes that include blank values #178

Merged
merged 2 commits into from
Jul 7, 2022

Conversation

jaysonlarose
Copy link
Contributor

Hey, y'all.

I got the developer of wezterm to add a "Copy as ANSI" option, but the truecolor ANSI codes it outputs have some blank values in them (they look like <esc>[48:2::255:180:69m). This here's a fix so that they get parsed correctly.

wezterm's new `get_selection_escapes_for_pane()` method).
@jaysonlarose jaysonlarose requested a review from ssbarnea as a code owner July 7, 2022 11:15
@ssbarnea ssbarnea changed the title Ffix for ANSI color codes that include blank values Fix for ANSI color codes that include blank values Jul 7, 2022
@ssbarnea ssbarnea added the bug This issue/PR relates to a bug. label Jul 7, 2022
@ssbarnea
Copy link
Member

ssbarnea commented Jul 7, 2022

@jaysonlarose Please investigate why tests are failing, we cannot merge it with them not passing.

@jaysonlarose
Copy link
Contributor Author

Oh, I see.

            try:
                params = [int(x) for x in re.split("[;:]", params) if len(x) > 0]
            except ValueError:
                params = [ANSI_FULL_RESET]

The converter is relying on that exception handler being used to interpret \x1b[m as an ANSI_FULL_RESET.

@jaysonlarose
Copy link
Contributor Author

I've switched to a slightly hackier way of removing blank fields. This one passes tests.

@ssbarnea ssbarnea merged commit b4224cd into pycontribs:main Jul 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue/PR relates to a bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants