aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bp.c2
-rw-r--r--print.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/bp.c b/bp.c
index 49e2317..08cde5c 100644
--- a/bp.c
+++ b/bp.c
@@ -253,6 +253,8 @@ static int print_matches(FILE *out, def_t *defs, file_t *f, pat_t *pattern)
if (matches > 0 || (f->filename[0] == '\0' && options.context_before == ALL_CONTEXT)) {
// Print trailing context lines:
print_match(out, &pr, NULL);
+ // Guarantee trailing newline:
+ if (!pr.needs_line_number) fprintf(out, "\n");
}
return matches;
diff --git a/print.c b/print.c
index de2e91a..dcebce9 100644
--- a/print.c
+++ b/print.c
@@ -262,8 +262,6 @@ void print_match(FILE *out, printer_t *pr, match_t *m)
// After the last match is printed, print the trailing context:
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->needs_line_number) fprintf(out, "\n");
}
if (pr->use_color) fprintf(out, "%s", color_normal);
}