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/text.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/text.c')
-rw-r--r-- | src/ui/text.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/ui/text.c b/src/ui/text.c index 016aeef1..65c7a256 100644 --- a/src/ui/text.c +++ b/src/ui/text.c | |||
@@ -734,8 +734,7 @@ static iRect run_Font_(iFont *d, const iRunArgs *args) { | |||
734 | for (const char *chPos = args->text.start; chPos != args->text.end; ) { | 734 | for (const char *chPos = args->text.start; chPos != args->text.end; ) { |
735 | iAssert(chPos < args->text.end); | 735 | iAssert(chPos < args->text.end); |
736 | const char *currentPos = chPos; | 736 | const char *currentPos = chPos; |
737 | if (*chPos == 0x1b) { | 737 | if (*chPos == 0x1b) { /* ANSI escape. */ |
738 | /* ANSI escape. */ | ||
739 | chPos++; | 738 | chPos++; |
740 | iRegExpMatch m; | 739 | iRegExpMatch m; |
741 | init_RegExpMatch(&m); | 740 | init_RegExpMatch(&m); |
@@ -821,7 +820,10 @@ static iRect run_Font_(iFont *d, const iRunArgs *args) { | |||
821 | continue; | 820 | continue; |
822 | } | 821 | } |
823 | if (ch == '\r') { | 822 | if (ch == '\r') { |
824 | const iChar esc = nextChar_(&chPos, args->text.end); | 823 | iChar esc = nextChar_(&chPos, args->text.end); |
824 | if (esc == '\r') { /* Extended range. */ | ||
825 | esc = nextChar_(&chPos, args->text.end) + asciiExtended_ColorEscape; | ||
826 | } | ||
825 | if (mode & draw_RunMode && ~mode & permanentColorFlag_RunMode) { | 827 | if (mode & draw_RunMode && ~mode & permanentColorFlag_RunMode) { |
826 | const iColor clr = get_Color(esc - asciiBase_ColorEscape); | 828 | const iColor clr = get_Color(esc - asciiBase_ColorEscape); |
827 | SDL_SetTextureColorMod(text_.cache, clr.r, clr.g, clr.b); | 829 | SDL_SetTextureColorMod(text_.cache, clr.r, clr.g, clr.b); |