Skip to content

Commit

Permalink
Linear: do not try to highlight results with no highlights
Browse files Browse the repository at this point in the history
  • Loading branch information
rjbs committed Jul 9, 2024
1 parent da53c8e commit ef522db
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/Synergy/Reactor/Linear.pm
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,11 @@ command search => {
my %is_highlight = map {; $_ => 1 } @$highlights;
my $pattern = join q{|}, map {; "\Q$_\E" } @$highlights;
sub ($text) {
# If we have a 0-length pattern, we'd be splitting on //, which would
# split on every byte, and we'd have 69,105 rich text elements, and
# Slack will think this is too many. -- rjbs, 2024-07-09
return bk_richtext($text) unless length $pattern;

map {; $is_highlight{$_} ? bk_bold($_) : bk_richtext($_) }
split /($pattern)/, $text;
}
Expand Down

0 comments on commit ef522db

Please sign in to comment.