Skip to content

Commit 9dc784a

Browse files
committed
Merge branch 'maint'
* maint: diff: reset color before printing newline
2 parents 336d09d + 06ff64a commit 9dc784a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

diff.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,9 +514,13 @@ const char *diff_get_color(int diff_use_color, enum color_diff ix)
514514

515515
static void emit_line(FILE *file, const char *set, const char *reset, const char *line, int len)
516516
{
517+
if (len > 0 && line[len-1] == '\n')
518+
len--;
519+
517520
fputs(set, file);
518521
fwrite(line, len, 1, file);
519522
fputs(reset, file);
523+
fputc('\n', file);
520524
}
521525

522526
static void emit_add_line(const char *reset, struct emit_callback *ecbdata, const char *line, int len)

0 commit comments

Comments
 (0)