Fixed bug with adding accidental extra newlines

This commit is contained in:
Bruce Hill 2021-01-29 16:55:38 -08:00
parent 51d5872c71
commit 906b03609b

View File

@ -395,7 +395,7 @@ void print_match(FILE *out, printer_t *pr, match_t *m)
const char *after_last = context_after(pr, pr->pos);
print_between(out, pr, pr->pos, after_last, pr->use_color ? color_normal : NULL);
// Guarantee trailing newline
if (pr->pos > pr->file->contents && pr->pos[-1] != '\n') fprintf(out, "\n");
if (!pr->needs_line_number) fprintf(out, "\n");
}
if (pr->use_color) fprintf(out, "%s", color_normal);
}