From: Kyle Meyer Date: Sat, 9 May 2020 18:57:46 +0000 (+0000) Subject: viewdiff: don't increment the reported hunk line number X-Git-Tag: v1.5.0~8 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=c8e8c8107913df9c67c5eeee86d20f633d11a6d4;p=public-inbox.git viewdiff: don't increment the reported hunk line number For a diff hunk starting at line N, diff_hunk() constructs the link with "#n(N + 1)". This sends the viewer one line below the first context line. Although this is minor and may not even be noticed, there's not an obvious reason to increment the line number, so switch to using the reported value as is. --- diff --git a/lib/PublicInbox/ViewDiff.pm b/lib/PublicInbox/ViewDiff.pm index 6fe9a0d7..536bb9e3 100644 --- a/lib/PublicInbox/ViewDiff.pm +++ b/lib/PublicInbox/ViewDiff.pm @@ -50,12 +50,12 @@ sub diff_hunk ($$$$) { if (defined($spfx) && defined($oid_a) && defined($oid_b)) { my ($n) = ($ca =~ /^-([0-9]+)/); - $n = defined($n) ? do { ++$n; "#n$n" } : ''; + $n = defined($n) ? "#n$n" : ''; $$dst .= qq(@@ {Q}$n">$ca); ($n) = ($cb =~ /^\+([0-9]+)/); - $n = defined($n) ? do { ++$n; "#n$n" } : ''; + $n = defined($n) ? "#n$n" : ''; $$dst .= qq( {Q}$n">$cb @@); } else { $$dst .= "@@ $ca $cb @@";