From 7ea8a1be5d714992d4118eda1f5d85b6bf9aa440 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaakko=20Kera=CC=88nen?= Date: Wed, 25 Oct 2023 14:58:45 +0300 Subject: [PATCH 1/1] Text: Bold attribute affects ANSI color palette --- src/ui/color.c | 6 +++--- src/ui/color.h | 3 ++- src/ui/font.c | 4 +++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/ui/color.c b/src/ui/color.c index cac8114d..3ea817ca 100644 --- a/src/ui/color.c +++ b/src/ui/color.c @@ -879,7 +879,7 @@ static const iColor ansi8BitColors_[256] = { { 255, 255, 255, 255 } }; -void ansiColors_Color(iRangecc escapeSequence, int fgDefault, int bgDefault, +void ansiColors_Color(iRangecc escapeSequence, int fgDefault, int bgDefault, iBool isHighIntensity, iColor *fg_out, iColor *bg_out, const char **endPos_out) { if (!fg_out && !bg_out && !endPos_out) { return; @@ -907,7 +907,7 @@ void ansiColors_Color(iRangecc escapeSequence, int fgDefault, int bgDefault, case 35: case 36: case 37: - fg = ansi8BitColors_[arg - 30]; + fg = ansi8BitColors_[arg - 30 + (isHighIntensity ? 8 : 0)]; break; case 38: case 48: { @@ -951,7 +951,7 @@ void ansiColors_Color(iRangecc escapeSequence, int fgDefault, int bgDefault, case 45: case 46: case 47: - bg = ansi8BitColors_[arg - 40]; + bg = ansi8BitColors_[arg - 40 + (isHighIntensity ? 8 : 0)]; break; case 49: bg = get_Color(bgDefault); diff --git a/src/ui/color.h b/src/ui/color.h index 8427e8f7..4b51982f 100644 --- a/src/ui/color.h +++ b/src/ui/color.h @@ -282,7 +282,8 @@ iBool loadPalette_Color (const char *path); void setThemePalette_Color (enum iColorTheme theme); void ansiColors_Color (iRangecc escapeSequence, int fgDefault, int bgDefault, - iColor *fg_out, iColor *bg_out, const char **endPos_out); /* out args can be NULL */ + iBool isHighIntensity, iColor *fg_out, iColor *bg_out, + const char **endPos_out); /* out args can be NULL */ const char * escape_Color (int color); enum iColorId parseEscape_Color (const char *cstr, const char **endp); diff --git a/src/ui/font.c b/src/ui/font.c index b558a22c..79722fb7 100644 --- a/src/ui/font.c +++ b/src/ui/font.c @@ -314,7 +314,9 @@ static void prepare_AttributedText_(iAttributedText *d, int overrideBaseDir, iCh else { const char *end; ansiColors_Color((iRangecc){ seqPos, sequence.end }, - d->baseFgColorId, none_ColorId, + d->baseFgColorId, + none_ColorId, + run.attrib.bold != 0, ansi & allowFg_AnsiFlag ? &run.fgColor_ : NULL, ansi & allowBg_AnsiFlag ? &run.bgColor_ : NULL, &end); -- 2.34.1