Skip to content

Commit 02ed769

Browse files
committed
Merge branch 'stedolan-master'
2 parents 0d1d5fb + 808c7da commit 02ed769

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/print.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ void print_file_matches(const char *path, const char *buf, const size_t buf_len,
150150
ssize_t lines_to_print = 0;
151151
char sep = '-';
152152
size_t i, j;
153+
int blanks_between_matches = opts.context || opts.after || opts.before;
153154

154155
if (opts.ackmate || opts.vimgrep) {
155156
sep = ':';
@@ -175,7 +176,7 @@ void print_file_matches(const char *path, const char *buf, const size_t buf_len,
175176
if (cur_match < matches_len && i == matches[cur_match].start) {
176177
print_context.in_a_match = TRUE;
177178
/* We found the start of a match */
178-
if (cur_match > 0 && opts.context && print_context.lines_since_last_match > (opts.before + opts.after + 1)) {
179+
if (cur_match > 0 && blanks_between_matches && print_context.lines_since_last_match > (opts.before + opts.after + 1)) {
179180
fprintf(out_fd, "--\n");
180181
}
181182

0 commit comments

Comments
 (0)