From: Eric Wong Date: Thu, 24 Dec 2015 02:32:08 +0000 (+0000) Subject: repobrowse: blob view no longer displays line numbers X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=889730062d2c9ce4a5b44a01f196dfe42172360f;p=thirdparty%2Fpublic-inbox.git repobrowse: blob view no longer displays line numbers We will always support links to them, but they're a waste of space and render poorly on small screens. Perhaps in the future we may support linking to function context headers based on .gitattributes, instead. --- diff --git a/lib/PublicInbox/RepoBrowseGitTree.pm b/lib/PublicInbox/RepoBrowseGitTree.pm index e0a7899c9..973c07467 100644 --- a/lib/PublicInbox/RepoBrowseGitTree.pm +++ b/lib/PublicInbox/RepoBrowseGitTree.pm @@ -5,6 +5,7 @@ use strict; use warnings; use base qw(PublicInbox::RepoBrowseBase); use PublicInbox::Git; +use PublicInbox::Hval qw(utf8_html); my %GIT_MODE = ( '100644' => ' ', # blob @@ -77,15 +78,13 @@ sub git_blob_show { return git_blob_binary($fh) if (index($buf, "\0") >= 0); $text_p = 1; - $fh->write('
'.PublicInbox::Hval::PRE); while (1) { - my @buf = split("\n", $buf, -1); + my @buf = split(/\r?\n/, $buf, -1); $buf = pop @buf; # last line, careful... - $n += scalar @buf; foreach my $l (@buf) { - $l = PublicInbox::Hval->new_bin($l)->as_html; - $l .= "\n"; - $fh->write($l); + ++$n; + $fh->write("". utf8_html($l). + "\n"); } last if ($$left == 0 || !defined $buf); @@ -95,12 +94,6 @@ sub git_blob_show { return unless defined($r) && $r > 0; $$left -= $r; } - - $fh->write('
');
-		foreach my $i (1..$n) {
-			$fh->write("$i\n");
-		}
-		$fh->write('
'); 0; }); }