Skip to content

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