1
0
mirror of https://github.com/BurntSushi/ripgrep.git synced 2025-11-29 05:57:07 +02:00

printer: hack in a fix for -l/--files-with-matches when using --pcre2 --multiline with look-around

The underlying issue here is #2528, which was introduced by commit
efd9cfb2fc which fixed another bug.

For the specific case of "did a file match," we can always assume the
match count is at least 1 here. But this doesn't fix the underlying
problem.

Fixes #3139
This commit is contained in:
Andrew Gallant
2025-09-21 13:56:40 -04:00
parent 491bf3f6d5
commit 8b5d3d1c1e
2 changed files with 46 additions and 1 deletions

View File

@@ -683,7 +683,11 @@ impl<'p, 's, M: Matcher, W: WriteColor> Sink for SummarySink<'p, 's, M, W> {
true
},
)?;
count
// Because of `find_iter_at_in_context` being a giant
// kludge internally, it's possible that it won't find
// *any* matches even though we clearly know that there is
// at least one. So make sure we record at least one here.
count.max(1)
};
if is_multi_line {
self.match_count += sink_match_count;