summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2019-06-07 21:29:05 +0200
committerSébastien Helleu <flashcode@flashtux.org>2019-06-07 21:29:05 +0200
commit7aa82db47106206b8e1bc0c56d34530ec25d23e6 (patch)
tree95a789a3485b1c7587b9f00e2c983904a51dbb14 /src
parentf065b43b71fe7b492607a66b2c13cf489af1b9b8 (diff)
downloadweechat-7aa82db47106206b8e1bc0c56d34530ec25d23e6.zip
core: replace char "," by "~" in color codes to separate foreground from background (closes #1264)
Diffstat (limited to 'src')
-rw-r--r--src/gui/curses/gui-curses-window.c7
-rw-r--r--src/gui/gui-color.c15
2 files changed, 19 insertions, 3 deletions
diff --git a/src/gui/curses/gui-curses-window.c b/src/gui/curses/gui-curses-window.c
index d0c5a77fe..10d1aac09 100644
--- a/src/gui/curses/gui-curses-window.c
+++ b/src/gui/curses/gui-curses-window.c
@@ -792,7 +792,12 @@ gui_window_string_apply_color_fg_bg (unsigned char **string, WINDOW *window)
ptr_string += 2;
}
}
- if (ptr_string[0] == ',')
+ /*
+ * note: the comma is an old separator not used any more
+ * (since WeeChat 2.6), but we still use it here so in case of /upgrade
+ * this will not break colors in old messages
+ */
+ if ((ptr_string[0] == ',') || (ptr_string[0] == '~'))
{
ptr_string++;
if (ptr_string[0] == GUI_COLOR_EXTENDED_CHAR)
diff --git a/src/gui/gui-color.c b/src/gui/gui-color.c
index 297943916..f067330aa 100644
--- a/src/gui/gui-color.c
+++ b/src/gui/gui-color.c
@@ -461,8 +461,13 @@ gui_color_get_custom (const char *color_name)
if (color_fg[0] && color_bg[0])
{
+ /*
+ * note: until WeeChat 2.5, the separator was a comma, and it has
+ * been changed to a tilde (to prevent problems with /eval and
+ * ${color:FF,BB}
+ */
snprintf (color[index_color], sizeof (color[index_color]),
- "%c%c%s,%s",
+ "%c%c%s~%s",
GUI_COLOR_COLOR_CHAR,
GUI_COLOR_FG_BG_CHAR,
color_fg,
@@ -659,7 +664,13 @@ gui_color_decode (const char *string, const char *replacement)
if (ptr_string[0] && ptr_string[1])
ptr_string += 2;
}
- if (ptr_string[0] == ',')
+ /*
+ * note: the comma is an old separator not used any
+ * more (since WeeChat 2.6), but we still use it here
+ * so in case of/upgrade this will not break colors in
+ * old messages
+ */
+ if ((ptr_string[0] == ',') || (ptr_string[0] == '~'))
{
if (ptr_string[1] == GUI_COLOR_EXTENDED_CHAR)
{