From c8e8c8107913df9c67c5eeee86d20f633d11a6d4 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Sat, 9 May 2020 18:57:46 +0000 Subject: [PATCH] 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. --- lib/PublicInbox/ViewDiff.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 @@"; -- 2.44.0