diff options
-rw-r--r-- | doc/diff.texi | 3 | ||||
-rw-r--r-- | src/context.c | 6 |
2 files changed, 6 insertions, 3 deletions
diff --git a/doc/diff.texi b/doc/diff.texi index 4bc687b..e764d18 100644 --- a/doc/diff.texi +++ b/doc/diff.texi @@ -836,7 +836,8 @@ line numbers look like @samp{@var{start},@var{count}}. Otherwise only its end line number appears. An empty hunk is considered to end at the line that precedes the hunk. -The lines common to both files begin with a space character. The lines +Lines common to both files begin with a space character, except that +the space is omitted if its line is empty. Lines that actually differ between the two files have one of the following indicator characters in the left print column: diff --git a/src/context.c b/src/context.c index 8c59961..8d4789a 100644 --- a/src/context.c +++ b/src/context.c @@ -337,8 +337,10 @@ pr_unidiff_hunk (struct change *hunk) if (!next || i < next->line0) { - putc (initial_tab ? '\t' : ' ', out); - print_1_line (NULL, &files[0].linbuf[i++]); + char const *const *line = &files[0].linbuf[i++]; + if (**line != '\n') + putc (initial_tab ? '\t' : ' ', out); + print_1_line (NULL, line); j++; } else |