]> Lady’s Gitweb - Gitweb/blobdiff - gitweb.perl
gitweb: Use descriptive names in esc_html_hl_regions()
[Gitweb] / gitweb.perl
index 144b9684ab71e5461d8641e11ffafec7d5c106d3303387ee865a983e26cc0973..e8f277c35014e650251461b9e1706750a37afdc0bb6a33f370c09531d1387518 100755 (executable)
@@ -1739,12 +1739,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));
This page took 0.311942 seconds and 4 git commands to generate.