diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2010-07-07 15:44:02 +0200 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2010-07-07 15:44:02 +0200 |
commit | 46fdee19b05ea9e775e46a67f0b31207cead009a (patch) | |
tree | 7ceddd29165ab5568164e90d2dc786a51e78e78e | |
parent | 869e4448b944c0cca0601588126f7a5e400b856e (diff) | |
download | weechat-46fdee19b05ea9e775e46a67f0b31207cead009a.zip |
Fix bug with replacement char in API function string_remove_color (bug #30296)
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | src/gui/gui-color.c | 72 |
2 files changed, 36 insertions, 40 deletions
@@ -1,7 +1,7 @@ WeeChat ChangeLog ================= Sébastien Helleu <flashcode@flashtux.org> -v0.3.3-dev, 2010-07-06 +v0.3.3-dev, 2010-07-07 Version 0.3.3 (under dev!) @@ -17,6 +17,8 @@ Version 0.3.3 (under dev!) process) * core: fix display bug with attributes like underlined in bars (bug #29889) * core: add hashtables with new functions in plugin API +* api: fix bug with replacement char in function string_remove_color + (bug #30296) * api: add function "string_expand_home", fix bug with replacement of home in paths * irc: fix display of local SSL certificate when it is sent to server diff --git a/src/gui/gui-color.c b/src/gui/gui-color.c index ef873bffc..f053ced2e 100644 --- a/src/gui/gui-color.c +++ b/src/gui/gui-color.c @@ -267,59 +267,53 @@ gui_color_decode (const char *string, const char *replacement) { case GUI_COLOR_COLOR_CHAR: ptr_string++; + switch (ptr_string[0]) + { + case GUI_COLOR_FG_CHAR: + case GUI_COLOR_BG_CHAR: + if (ptr_string[1] && ptr_string[2]) + ptr_string += 3; + break; + case GUI_COLOR_FG_BG_CHAR: + if (ptr_string[1] && ptr_string[2] && (ptr_string[3] == ',') + && ptr_string[4] && ptr_string[5]) + ptr_string += 6; + break; + case GUI_COLOR_BAR_CHAR: + ptr_string++; + switch (ptr_string[0]) + { + case GUI_COLOR_BAR_FG_CHAR: + case GUI_COLOR_BAR_BG_CHAR: + case GUI_COLOR_BAR_DELIM_CHAR: + case GUI_COLOR_BAR_START_INPUT_CHAR: + case GUI_COLOR_BAR_START_INPUT_HIDDEN_CHAR: + case GUI_COLOR_BAR_MOVE_CURSOR_CHAR: + ptr_string++; + break; + } + break; + default: + if (isdigit (ptr_string[0]) && isdigit (ptr_string[1])) + ptr_string += 2; + break; + } if (replacement && replacement[0]) { out[out_pos] = replacement[0]; out_pos++; } - else - { - switch (ptr_string[0]) - { - case GUI_COLOR_FG_CHAR: - case GUI_COLOR_BG_CHAR: - if (ptr_string[1] && ptr_string[2]) - ptr_string += 3; - break; - case GUI_COLOR_FG_BG_CHAR: - if (ptr_string[1] && ptr_string[2] && (ptr_string[3] == ',') - && ptr_string[4] && ptr_string[5]) - ptr_string += 6; - break; - case GUI_COLOR_BAR_CHAR: - ptr_string++; - switch (ptr_string[0]) - { - case GUI_COLOR_BAR_FG_CHAR: - case GUI_COLOR_BAR_BG_CHAR: - case GUI_COLOR_BAR_DELIM_CHAR: - case GUI_COLOR_BAR_START_INPUT_CHAR: - case GUI_COLOR_BAR_START_INPUT_HIDDEN_CHAR: - case GUI_COLOR_BAR_MOVE_CURSOR_CHAR: - ptr_string++; - break; - } - break; - default: - if (isdigit (ptr_string[0]) && isdigit (ptr_string[1])) - ptr_string += 2; - break; - } - } break; case GUI_COLOR_SET_WEECHAT_CHAR: case GUI_COLOR_REMOVE_WEECHAT_CHAR: ptr_string++; + if (ptr_string[0]) + ptr_string++; if (replacement && replacement[0]) { out[out_pos] = replacement[0]; out_pos++; } - else - { - if (ptr_string[0]) - ptr_string++; - } break; case GUI_COLOR_RESET_CHAR: ptr_string++; |