From ef522db659dc22931582c96c0d1060d220a4fdf5 Mon Sep 17 00:00:00 2001 From: Ricardo Signes Date: Tue, 9 Jul 2024 13:19:59 -0400 Subject: [PATCH] Linear: do not try to highlight results with no highlights --- lib/Synergy/Reactor/Linear.pm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/Synergy/Reactor/Linear.pm b/lib/Synergy/Reactor/Linear.pm index 9dd92353..badcba98 100644 --- a/lib/Synergy/Reactor/Linear.pm +++ b/lib/Synergy/Reactor/Linear.pm @@ -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; }