6c1aee8
commit ff81775f4eb6ab9a91b75e4031e8216654c0c76a
6c1aee8
Author: Andreas Gruenbacher <agruen@gnu.org>
6c1aee8
Date:   Fri Aug 17 10:31:22 2018 +0200
6c1aee8
6c1aee8
    Make the (debug & 2) output more useful
6c1aee8
    
6c1aee8
    * src/pch.c (another_hunk): In the (debug & 2) output, fix how empty
6c1aee8
    lines that are not part of the patch context are printed.  Also, add
6c1aee8
    newlines to lines that are missing them to keep the output readable.
6c1aee8
6c1aee8
diff --git a/src/pch.c b/src/pch.c
6c1aee8
index 1bb3153..e92bc64 100644
6c1aee8
--- a/src/pch.c
6c1aee8
+++ b/src/pch.c
6c1aee8
@@ -1916,8 +1916,13 @@ another_hunk (enum diff difftype, bool rev)
6c1aee8
 	lin i;
6c1aee8
 
6c1aee8
 	for (i = 0; i <= p_end + 1; i++) {
6c1aee8
-	    fprintf (stderr, "%s %c",
6c1aee8
-		     format_linenum (numbuf0, i),
6c1aee8
+	    fputs (format_linenum (numbuf0, i), stderr);
6c1aee8
+	    if (p_Char[i] == '\n')
6c1aee8
+	      {
6c1aee8
+	        fputc('\n', stderr);
6c1aee8
+		continue;
6c1aee8
+	      }
6c1aee8
+	    fprintf (stderr, " %c",
6c1aee8
 		     p_Char[i]);
6c1aee8
 	    if (p_Char[i] == '*')
6c1aee8
 	      fprintf (stderr, " %s,%s\n",
6c1aee8
@@ -1930,7 +1935,8 @@ another_hunk (enum diff difftype, bool rev)
6c1aee8
 	    else if (p_Char[i] != '^')
6c1aee8
 	      {
6c1aee8
 		fputs(" |", stderr);
6c1aee8
-		pch_write_line (i, stderr);
6c1aee8
+		if (! pch_write_line (i, stderr))
6c1aee8
+		  fputc('\n', stderr);
6c1aee8
 	      }
6c1aee8
 	    else
6c1aee8
 	      fputc('\n', stderr);