summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
inline | side by side (from parent 1:
32be0fe)
The $s->[0] and $s->[1] variables look a bit cryptic. Let's rename them
to $begin and $end so that it's clear what they do.
Suggested-by: Jakub Narębski <redacted>
Signed-off-by: Michał Kiedrowicz <redacted>
Signed-off-by: Junio C Hamano <redacted>
my $pos = 0;
for my $s (@sel) {
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;
+ 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));
}
$out .= esc_html(substr($str, $pos))
if ($pos < length($str));