diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-02-14 18:36:18 +0200 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-02-14 18:36:18 +0200 |
commit | d491b47e3d5dd916b7377edc2e5c08be9d375b3e (patch) | |
tree | 1620070bcc52b94d52e993423411e27443974b86 /src/ui/color.c | |
parent | 056b79839f7b0ecb503f223e483d97841c917bc8 (diff) |
Color: Extended range for color escapes
Use a double \r for color IDs 95 and beyond.
Diffstat (limited to 'src/ui/color.c')
-rw-r--r-- | src/ui/color.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/ui/color.c b/src/ui/color.c index 870db2d0..3adf857d 100644 --- a/src/ui/color.c +++ b/src/ui/color.c | |||
@@ -427,8 +427,12 @@ const char *escape_Color(int color) { | |||
427 | if (color >= 0 && color < (int) iElemCount(esc)) { | 427 | if (color >= 0 && color < (int) iElemCount(esc)) { |
428 | return esc[color]; | 428 | return esc[color]; |
429 | } | 429 | } |
430 | iAssert(asciiBase_ColorEscape + color <= 127); | 430 | /* Double-\r is used for range extension. */ |
431 | return format_CStr("\r%c", asciiBase_ColorEscape + color); | 431 | if (color + asciiBase_ColorEscape > 127) { |
432 | iAssert(color - asciiExtended_ColorEscape + asciiBase_ColorEscape <= 127); | ||
433 | return format_CStr("\r\r%c", color - asciiExtended_ColorEscape + asciiBase_ColorEscape); | ||
434 | } | ||
435 | return format_CStr("\r%c", color + asciiBase_ColorEscape); | ||
432 | } | 436 | } |
433 | 437 | ||
434 | iHSLColor setSat_HSLColor(iHSLColor d, float sat) { | 438 | iHSLColor setSat_HSLColor(iHSLColor d, float sat) { |