diff options
author | ailin-nemui <ailin-nemui@users.noreply.github.com> | 2017-11-26 15:18:43 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-26 15:18:43 +0100 |
commit | 5637a8df4305576a402f2dd272252835d4e84bb5 (patch) | |
tree | 121ea712e20e9b2ca13787517cb4221558979b8b /src/fe-common/core | |
parent | 3792bc9ba95b8b9fd12ad60b86b8bbb06e913dc1 (diff) | |
parent | 47400d405a0680bfe4d69ce8b06ecbfd09931999 (diff) | |
download | irssi-5637a8df4305576a402f2dd272252835d4e84bb5.zip |
Merge pull request #790 from ailin-nemui/mirc-colour
reset colour at comma, like mIRC
Diffstat (limited to 'src/fe-common/core')
-rw-r--r-- | src/fe-common/core/formats.c | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/src/fe-common/core/formats.c b/src/fe-common/core/formats.c index 005e6fb7..37db6f7c 100644 --- a/src/fe-common/core/formats.c +++ b/src/fe-common/core/formats.c @@ -1072,31 +1072,27 @@ 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 (i_isdigit(**str)) { - fg = fg*10 + (**str-'0'); - (*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)++; + bg = **str-'0'; + (*str)++; + if (i_isdigit(**str)) { + bg = bg*10 + (**str-'0'); (*str)++; - if (i_isdigit(**str)) { - bg = bg*10 + (**str-'0'); - (*str)++; - } } } } |