diff options
Diffstat (limited to 'gitweb')
-rwxr-xr-x | gitweb/gitweb.perl | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index a8b5fad266..1c54301582 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -1738,12 +1738,15 @@ sub esc_html_hl_regions { my $pos = 0; for my $s (@sel) { - $out .= esc_html(substr($str, $pos, $s->[0] - $pos)) - if ($s->[0] - $pos > 0); - $out .= $cgi->span({-class => $css_class}, - esc_html(substr($str, $s->[0], $s->[1] - $s->[0]))); + my ($begin, $end) = @$s; - $pos = $s->[1]; + my $escaped = esc_html(substr($str, $begin, $end - $begin)); + + $out .= esc_html(substr($str, $pos, $begin - $pos)) + if ($begin - $pos > 0); + $out .= $cgi->span({-class => $css_class}, $escaped); + + $pos = $end; } $out .= esc_html(substr($str, $pos)) if ($pos < length($str)); |