If $end is equal to or less than $begin, esc_html_hl_regions() generates an empty <span> element. It normally shouldn't be visible in the web browser, but it doesn't look good when looking at page source. It also minimally increases generated page size for no special reason. Signed-off-by: Michał Kiedrowicz <michal.kiedrowicz@xxxxxxxxx> Acked-by: Jakub Narębski <jnareb@xxxxxxxxx> --- gitweb/gitweb.perl | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index 1c54301..588b87d 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -1740,6 +1740,9 @@ sub esc_html_hl_regions { for my $s (@sel) { my ($begin, $end) = @$s; + # Don't create empty <span> elements. + next if $end <= $begin; + my $escaped = esc_html(substr($str, $begin, $end - $begin)); $out .= esc_html(substr($str, $pos, $begin - $pos)) -- 1.7.8.4 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html