Skip to content

Commit

Permalink
Reset foreground and background while no color code is specified
Browse files Browse the repository at this point in the history
  • Loading branch information
SilverRainZ committed Sep 21, 2017
1 parent 1347101 commit ccd33d4
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/fe-common/core/formats.c
Expand Up @@ -1067,8 +1067,9 @@ static const char *get_ansi_color(THEME_REC *theme, const char *str,
/* parse MIRC color string */
static void get_mirc_color(const char **str, int *fg_ret, int *bg_ret)
{
int fg, bg;
int fg, bg, hasfg;

hasfg = 0;
fg = fg_ret == NULL ? -1 : *fg_ret;
bg = bg_ret == NULL ? -1 : *bg_ret;

Expand All @@ -1078,6 +1079,7 @@ static void get_mirc_color(const char **str, int *fg_ret, int *bg_ret)
} else {
/* foreground color */
if (**str != ',') {
hasfg = 1;
fg = **str-'0';
(*str)++;
if (i_isdigit(**str)) {
Expand All @@ -1087,8 +1089,12 @@ static void get_mirc_color(const char **str, int *fg_ret, int *bg_ret)
}
if (**str == ',') {
/* background color */
if (!i_isdigit((*str)[1]))
if (!i_isdigit((*str)[1])) {
bg = -1;
if (!hasfg) {
fg = -1;
}
}
else {
(*str)++;
bg = **str-'0';
Expand Down

0 comments on commit ccd33d4

Please sign in to comment.