aboutsummaryrefslogtreecommitdiff
path: root/bp.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2021-09-22 22:57:44 -0700
committerBruce Hill <bruce@bruce-hill.com>2021-09-22 22:57:44 -0700
commitf2db62cb551b6fb783f977e0f450e9c7f4f8d963 (patch)
tree57ee3dce11195e337040433520a10f31152dd0a3 /bp.c
parenta712a61e4d4a0ce4de241eeb3fdeef0c1515f139 (diff)
Moved trailing newline guarantee code into bp.c
Diffstat (limited to 'bp.c')
-rw-r--r--bp.c2
1 files changed, 2 insertions, 0 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;