diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2006-09-05 22:57:09 +0000 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2006-09-05 22:57:09 +0000 |
commit | a204b37fb2d871df551d9bf6fb722d8f269a0754 (patch) | |
tree | 29484f1cb3742b616a01bb30fd33e150ce43adbf | |
parent | 19397f6b83f488de0e54c7ea4972e86515677752 (diff) | |
download | diffutils-a204b37fb2d871df551d9bf6fb722d8f269a0754.tar.gz |
* doc/diff.texi (Detailed Unified): Don't output trailing white
space unless the input data has it.
* src/context.c (pr_unidiff_hunk): Likewise.
-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 |