summaryrefslogtreecommitdiff
path: root/src/fe-common
diff options
context:
space:
mode:
authorailin-nemui <ailin-nemui@users.noreply.github.com>2017-11-15 16:33:06 +0100
committerailin-nemui <ailin-nemui@users.noreply.github.com>2017-11-15 16:35:25 +0100
commit3acc72f842a021ffcff8809c1f245ca614f68598 (patch)
treebec6354c4ee53d4b9514afa3967b2efa9e5cb5b5 /src/fe-common
parent4e8c1548e01c15a9934b1a2d02ce2396ab859957 (diff)
downloadirssi-3acc72f842a021ffcff8809c1f245ca614f68598.zip
reset colour at comma, like mIRC
Fixes #742 and #740
Diffstat (limited to 'src/fe-common')
-rw-r--r--src/fe-common/core/formats.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/fe-common/core/formats.c b/src/fe-common/core/formats.c
index 005e6fb7..a340bffa 100644
--- a/src/fe-common/core/formats.c
+++ b/src/fe-common/core/formats.c
@@ -1072,7 +1072,8 @@ static void get_mirc_color(const char **str, int *fg_ret, int *bg_ret)
fg = fg_ret == NULL ? -1 : *fg_ret;
bg = bg_ret == NULL ? -1 : *bg_ret;
- if (!i_isdigit(**str) && **str != ',') {
+ if (!i_isdigit(**str)) {
+ /* turn off color */
fg = -1;
bg = -1;
} else {
@@ -1085,11 +1086,8 @@ static void get_mirc_color(const char **str, int *fg_ret, int *bg_ret)
(*str)++;
}
}
- if (**str == ',') {
+ if ((*str)[0] == ',' && i_isdigit((*str)[1])) {
/* background color */
- if (!i_isdigit((*str)[1]))
- bg = -1;
- else {
(*str)++;
bg = **str-'0';
(*str)++;
@@ -1097,7 +1095,6 @@ static void get_mirc_color(const char **str, int *fg_ret, int *bg_ret)
bg = bg*10 + (**str-'0');
(*str)++;
}
- }
}
}