Skip to content

ANSI: incorrect merge of \x1b[22m (reset dim+bold) with \x1b[2m (dim) #4088

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
sam-mccall opened this issue Mar 22, 2025 · 2 comments · May be fixed by #4090
Open

ANSI: incorrect merge of \x1b[22m (reset dim+bold) with \x1b[2m (dim) #4088

sam-mccall opened this issue Mar 22, 2025 · 2 comments · May be fixed by #4090

Comments

@sam-mccall
Copy link

The following ansi sequence seems to be mistranslated by zellij:

printf "\x1b[36m one \x1b[2m two \x1b[1m three \x1b[22m\x1b[2m four"
        ^green       ^dim        ^bold         ^reset  ^dim

The word "four" should be dim, but is not.
(22m clears dim + bold state, and 2m reapplies it).

If there are characters between the reset and the dim, it works correctly:

printf "\x1b[36m one \x1b[2m two \x1b[1m three \x1b[22m \x1b[2m four"
                                                       ^space added here

Image

This is interpreted correctly by the same terminal (foot) without zellij:

Image

This is noticeable when editing with helix, as it breaks inactive-code dimming when the theme uses bold:

Image

zellij-22.log
zellij.log

Basic information

zellij --version: zellij 0.42.1

stty size: 69 134

uname -av or ver(Windows): Linux anacletus 6.12.12-1rodete2-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.12.12-1rodete2 (2025-02-28) x86_64 GNU/Linux

@sam-mccall
Copy link
Author

sam-mccall commented Mar 22, 2025

Minimal incorrect case is \x1b[1;2mX\x1b[22m\x1b[2mY, where Y should be dim:

  • we need at least one character before the reset (\x1b[1;2m\x1b[22m\x1b[2mY is correct)
  • we need that character to be both bold and dim (\x1b[1mX\x1b[22m\x1b[2mY and \x1b[1mX\x1b[22m\x1b[2mY are both correct)
  • we need no characters between reset and dim (\x1b[1mX\x1b[22mZ\x1b[2mY is correct)

This bug also applies to bold: \x1b[1mX\x1b[22m\x1b[1mY is incorrect, Y should be bold but is not

@sam-mccall sam-mccall linked a pull request Mar 22, 2025 that will close this issue
@Kazimazi
Copy link

Kazimazi commented May 8, 2025

Is this the same issue as when a highlight breaks underline?

Image

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 a pull request may close this issue.

2 participants