You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
pyte current supports setting foreground/background color, but it only supports ; delimited parameters. My understanding is that this is a legacy of xterm mis-interpreting some ancient specification:
We used semicolon (like other SGR parameters) for separating the R/G/B values in the escape sequence, since a copy of ITU T.416 (ISO-8613-6) which presumably clarified the use of colon for this feature was costly.
In other words, there are 2 ways set the foreground color of text (this applies to other SGR parameters, I'm just picking foreground color to be concrete):
echo -e "\x1b[38:5:5mfoo\x1b[mbar": Uses colons to delimit context/subparameters
echo -e "\x1b[38;5;5mfoo\x1b[mbar": Uses semicolons. Creates ambiguity between parameters and context/subparameters. Discouraged.
Let's see how pyte handles these things. Here's my test script:
$ python test.py $'\x1b[38;5;5mfoo\x1b[mbar'
f fg=cd00cd
o fg=cd00cd
o fg=cd00cd
b fg=default
a fg=default
r fg=default
colon delimited
pyte does not "understand" the colors, and even worse, there's unnecessary spew
printed. The spew will be addressed by my upcoming changes for #178.
$ python test.py $'\x1b[38:5:5mfoo\x1b[mbar'
5 fg=default
: fg=default
5 fg=default
m fg=default
f fg=default
o fg=default
o fg=default
b fg=default
a fg=default
r fg=default
The text was updated successfully, but these errors were encountered:
jfly
changed the title
Feature request: support for SGR parameters with colon delimited context
Feature request: support for SGR subparameters
Oct 8, 2024
jfly
added a commit
to jfly/pyte
that referenced
this issue
Oct 8, 2024
This fixesselectel#178.
Before, we assumed that CSI parameters are only integers. However, that
caused us to barf in weird ways when presented with CSI parameters that
contain `:`-delimited subparameters.
This update to the parsing code causes us to parse those subparameters,
and then immediately discard them. That may seem kind of weird, but I'm
laying the groundwork for a followup change to the SGR handling code to
actually be aware of subparameters
(selectel#179). I just didn't want to
muddy this diff with that change as well.
pyte current supports setting foreground/background color, but it only supports
;
delimited parameters. My understanding is that this is a legacy of xterm mis-interpreting some ancient specification:In other words, there are 2 ways set the foreground color of text (this applies to other SGR parameters, I'm just picking foreground color to be concrete):
echo -e "\x1b[38:5:5mfoo\x1b[mbar"
: Uses colons to delimit context/subparametersecho -e "\x1b[38;5;5mfoo\x1b[mbar"
: Uses semicolons. Creates ambiguity between parameters and context/subparameters. Discouraged.Let's see how pyte handles these things. Here's my test script:
test.py
pyte
0.8.2semicolon delimited
This works as expected:
colon delimited
pyte does not "understand" the colors, and even worse, there's unnecessary spew
printed. The spew will be addressed by my upcoming changes for
#178.
The text was updated successfully, but these errors were encountered: