From 4be3ee4d25fc777a2508fdd03dc8f701cf4ca91d Mon Sep 17 00:00:00 2001 From: Andreas Gruenbacher Date: Fri, 17 Aug 2018 10:31:22 +0200 Subject: [PATCH] Make the (debug & 2) output more useful * src/pch.c (another_hunk): In the (debug & 2) output, fix how empty lines that are not part of the patch context are printed. Also, add newlines to lines that are missing them to keep the output readable. Signed-off-by: Xibo.Wang --- src/pch.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/pch.c b/src/pch.c index 4368561..aa0caf4 100644 --- a/src/pch.c +++ b/src/pch.c @@ -1923,8 +1923,13 @@ another_hunk (enum diff difftype, bool rev) lin i; for (i = 0; i <= p_end + 1; i++) { - fprintf (stderr, "%s %c", - format_linenum (numbuf0, i), + fputs (format_linenum (numbuf0, i), stderr); + if (p_Char[i] == '\n') + { + fputc('\n', stderr); + continue; + } + fprintf (stderr, " %c", p_Char[i]); if (p_Char[i] == '*') fprintf (stderr, " %s,%s\n", @@ -1937,7 +1942,8 @@ another_hunk (enum diff difftype, bool rev) else if (p_Char[i] != '^') { fputs(" |", stderr); - pch_write_line (i, stderr); + if (! pch_write_line (i, stderr)) + fputc('\n', stderr); } else fputc('\n', stderr); -- 1.8.3.1