3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-12-24 11:42:35 +01:00

Interpreter: do not dehighlight single-letter nicks or nicks in URLs

This commit is contained in:
Pragmatic Software 2020-03-22 15:52:47 -07:00
parent 3c7ad2c529
commit 8e9742a0e4

View File

@ -878,9 +878,10 @@ sub dehighlight_nicks {
my @nicks = $self->{pbot}->{nicklist}->get_nicks($channel);
return $line if not @nicks;
foreach my $nick (@nicks) {
next if length $nick == 1;
$nick = quotemeta $nick;
my $const_line = $line;
while ($const_line =~ m/(?<![^\W_])($nick)(?![^\W_:])/gi) {
while ($const_line =~ m/(?<![^\W_\.\\])($nick)(?![^\W_:])/gi) {
my $match = $1;
$match =~ s/^(.)/$1\x{200b}/;
$line =~ s/$nick(?!:)/$match/i;