1
0
mirror of https://github.com/irssi/irssi.git synced 2024-09-01 04:14:16 -04:00

Merge pull request #790 from ailin-nemui/mirc-colour

reset colour at comma, like mIRC
This commit is contained in:
ailin-nemui 2017-11-26 15:18:43 +01:00 committed by GitHub
commit 5637a8df43
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1072,33 +1072,29 @@ 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 {
/* foreground color */
if (**str != ',') {
fg = **str-'0';
fg = **str-'0';
(*str)++;
if (i_isdigit(**str)) {
fg = fg*10 + (**str-'0');
(*str)++;
}
if ((*str)[0] == ',' && i_isdigit((*str)[1])) {
/* background color */
(*str)++;
bg = **str-'0';
(*str)++;
if (i_isdigit(**str)) {
fg = fg*10 + (**str-'0');
bg = bg*10 + (**str-'0');
(*str)++;
}
}
if (**str == ',') {
/* background color */
if (!i_isdigit((*str)[1]))
bg = -1;
else {
(*str)++;
bg = **str-'0';
(*str)++;
if (i_isdigit(**str)) {
bg = bg*10 + (**str-'0');
(*str)++;
}
}
}
}
if (fg_ret) *fg_ret = fg;