Terminal: parse foreground+background in a single SGR escape.
* Whilst testing `starship`, it was apparent that setting both the foreground & background colours in a single SGR escape is deemed a valid escape sequence. * E.g. `ESC[48;2;58;149;199;38;2;47;121;161m` would set the background to RGB(58,149,199) and foreground to RGB(47,121,161). Change-Id: I3c14afe2ddf673c85d1678a01e7258587b17f21b Reviewed-on: https://review.haiku-os.org/c/haiku/+/5210 Reviewed-by: Jérôme Duval <[email protected]> Tested-by: Commit checker robot <[email protected]>
This commit is contained in:
committed by
Jérôme Duval
parent
945a908417
commit
c285a1585e
@@ -836,12 +836,16 @@ TermParse::EscParse()
|
|||||||
|
|
||||||
case 38:
|
case 38:
|
||||||
{
|
{
|
||||||
if (nparam == 3 && param[1] == 5)
|
if (nparam >= 3 && param[row+1] == 5) {
|
||||||
attributes.SetIndexedForeground(param[2]);
|
attributes.SetIndexedForeground(param[row+2]);
|
||||||
else if (nparam == 5 && param[1] == 2)
|
row += 2;
|
||||||
attributes.SetDirectForeground(param[2], param[3], param[4]);
|
} else if (nparam >= 5 && param[row+1] == 2) {
|
||||||
|
attributes.SetDirectForeground(param[row+2], param[row+3], param[row+4]);
|
||||||
|
row += 4;
|
||||||
|
} else {
|
||||||
|
row = nparam; // force exit of the parsing
|
||||||
|
}
|
||||||
|
|
||||||
row = nparam; // force exit of the parsing
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -871,12 +875,16 @@ TermParse::EscParse()
|
|||||||
|
|
||||||
case 48:
|
case 48:
|
||||||
{
|
{
|
||||||
if (nparam == 3 && param[1] == 5)
|
if (nparam >= 3 && param[row+1] == 5) {
|
||||||
attributes.SetIndexedBackground(param[2]);
|
attributes.SetIndexedBackground(param[row+2]);
|
||||||
else if (nparam == 5 && param[1] == 2)
|
row += 2;
|
||||||
attributes.SetDirectBackground(param[2], param[3], param[4]);
|
} else if (nparam >= 5 && param[row+1] == 2) {
|
||||||
|
attributes.SetDirectBackground(param[row+2], param[row+3], param[row+4]);
|
||||||
|
row += 4;
|
||||||
|
} else {
|
||||||
|
row = nparam; // force exit of the parsing
|
||||||
|
}
|
||||||
|
|
||||||
row = nparam; // force exit of the parsing
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user