From c7c0b49515a2dec968c38fe7508db79cace71c31 Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Thu, 6 Feb 2020 03:49:33 -0800 Subject: [PATCH] Interpreter: preserve case of dehighlight --- PBot/Interpreter.pm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/PBot/Interpreter.pm b/PBot/Interpreter.pm index 2ec22145..f6dab5ed 100644 --- a/PBot/Interpreter.pm +++ b/PBot/Interpreter.pm @@ -925,9 +925,11 @@ sub dehighlight_nicks { my $zwsp = "\x{200b}"; foreach my $nick (keys %{$nicklist->{$channel}}) { my $n = quotemeta $nicklist->{$channel}->{$nick}->{nick}; - my $n_nh = $nicklist->{$channel}->{$nick}->{nick}; - $n_nh =~ s/^(.)/$1$zwsp/; - $line =~ s/$n/$n_nh/gi; + while ($line =~ m/($n)/gi) { + my $match = $1; + $match =~ s/^(.)/$1$zwsp/; + $line =~ s/$n/$match/i; + } } return $line; }