summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2024-05-11 13:51:35 +0200
committerSébastien Helleu <flashcode@flashtux.org>2024-05-11 14:05:52 +0200
commit1a0b9427e0b27bd9f1a63a4f4eda24e1f3c93a48 (patch)
treeed6e8dd1bd8b514a06838163b70b2b78aa6b11f5 /src
parent32b01a606c3ecf64b05b139c52fedc52cb00c7ab (diff)
downloadweechat-1a0b9427e0b27bd9f1a63a4f4eda24e1f3c93a48.zip
core: fix conversion of WeeChat bar colors to ANSI colors
Diffstat (limited to 'src')
-rw-r--r--src/gui/gui-color.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/gui/gui-color.c b/src/gui/gui-color.c
index c895d5e7c..8823bde65 100644
--- a/src/gui/gui-color.c
+++ b/src/gui/gui-color.c
@@ -1544,8 +1544,41 @@ gui_color_encode_ansi (const char *string)
switch (ptr_string[0])
{
case GUI_COLOR_BAR_FG_CHAR:
+ snprintf (str_concat, sizeof (str_concat),
+ "\x1B[%dm",
+ GUI_COLOR_ANSI_DEFAULT_FG);
+ string_dyn_concat (out, str_concat, -1);
+ ptr_string++;
+ break;
case GUI_COLOR_BAR_BG_CHAR:
+ snprintf (str_concat, sizeof (str_concat),
+ "\x1B[%dm",
+ GUI_COLOR_ANSI_DEFAULT_BG);
+ string_dyn_concat (out, str_concat, -1);
+ ptr_string++;
+ break;
case GUI_COLOR_BAR_DELIM_CHAR:
+ color = CONFIG_COLOR(config_color_chat_delimiters);
+ if (color & GUI_COLOR_EXTENDED_FLAG)
+ {
+ snprintf (str_concat, sizeof (str_concat),
+ "\x1B[48;5;%dm",
+ color & GUI_COLOR_EXTENDED_MASK);
+ }
+ else
+ {
+ ansi_color = gui_color_weechat_to_ansi (
+ CONFIG_COLOR(config_color_chat_delimiters));
+ snprintf (str_concat, sizeof (str_concat),
+ "\x1B[%dm",
+ (ansi_color < 0) ?
+ GUI_COLOR_ANSI_DEFAULT_FG :
+ ((ansi_color < 8) ?
+ ansi_color + 40 : ansi_color - 8 + 100));
+ }
+ string_dyn_concat (out, str_concat, -1);
+ ptr_string++;
+ break;
case GUI_COLOR_BAR_START_INPUT_CHAR:
case GUI_COLOR_BAR_START_INPUT_HIDDEN_CHAR:
case GUI_COLOR_BAR_MOVE_CURSOR_CHAR: