|
19 | 19 | # along with this program. If not, see <http://www.gnu.org/licenses/>.
|
20 | 20 |
|
21 | 21 | # history:
|
| 22 | +# 4.0.2: fix formatting if a color reset is present (#457) |
22 | 23 | # 4.0.1: fix display of multiline messages
|
23 | 24 | # 4.0: add compatibility with XDG directories (WeeChat >= 3.2)
|
24 | 25 | # 3.9: add compatibility with new weechat_print modifier data (WeeChat >= 2.9)
|
|
89 | 90 |
|
90 | 91 | use strict;
|
91 | 92 | my $PRGNAME = "colorize_lines";
|
92 |
| -my $VERSION = "4.0.1"; |
| 93 | +my $VERSION = "4.0.2"; |
93 | 94 | my $AUTHOR = "Nils Görs <weechatter\@arcor.de>";
|
94 | 95 | my $LICENCE = "GPL3";
|
95 | 96 | my $DESCR = "Colorize users' text in chat area with their nick color, including highlights";
|
@@ -200,7 +201,11 @@ sub colorize_cb
|
200 | 201 | return $string if ($config{own_lines} eq "off") && not ($channel_color) && ( $config{alternate_color} eq "" );
|
201 | 202 |
|
202 | 203 | $color = weechat::color($config{own_lines_color});
|
203 |
| - $color = weechat::color("chat_nick_self") if ($config{own_lines_color} eq ""); |
| 204 | + |
| 205 | + # "chat_nick_self" colors are fixed (\03115) and cannot have the "keep attribute" |
| 206 | + # code set, so translate it to weechat's colors |
| 207 | + $color = weechat::color(weechat::config_string(weechat::config_get("weechat.color.chat_nick_self"))) if ($config{own_lines_color} eq ""); |
| 208 | + |
204 | 209 | $color = $channel_color if ($channel_color) && ($config{own_lines} eq "off");
|
205 | 210 |
|
206 | 211 | $color = get_alternate_color($buf_ptr,$alternate_last,$alternate_color1,$alternate_color2) if ( $config{alternate_color} ne "" ) &&
|
@@ -275,6 +280,19 @@ sub colorize_cb
|
275 | 280 | }
|
276 | 281 | ######################################## inject colors and go!
|
277 | 282 |
|
| 283 | + # color doesn't have a "keep attribute", so replace its code to keep them |
| 284 | + # when there's a reset color code (\031\034) in the line |
| 285 | + my $keep_attr = "|"; |
| 286 | + if ($color !~ /\Q$keep_attr\E/) { |
| 287 | + $color =~ s/ |
| 288 | + \o{031} |
| 289 | + (?> [F*] | F@ | \*@) |
| 290 | + [*!\/_%.]?+ |
| 291 | + \K |
| 292 | + (\d{2,5}+) |
| 293 | + /${keep_attr}$1/x; |
| 294 | + } |
| 295 | + |
278 | 296 | my $out = "";
|
279 | 297 | if ($action) {
|
280 | 298 | # remove the first color reset - after * nick
|
|
0 commit comments