From fdea9723cac34b6e93e259c2366c94e8319de0ca Mon Sep 17 00:00:00 2001 From: Andrew Gallant Date: Mon, 22 Sep 2025 22:12:15 -0400 Subject: [PATCH] doc: clarify a case where -m/--max-count is not strictly respected In #2843, it's requested that these trailing contextual lines should be displayed as non-matching because they exceed the limit. While reasonable, I think that: 1. This would be a weird complication to the implementation. 2. This would overall be less intuitive and more complex. Today, there is never a case where ripgrep emits a matching line in a way where the match isn't highlighted. Closes #2843 --- crates/core/flags/defs.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/crates/core/flags/defs.rs b/crates/core/flags/defs.rs index bbe13483..65e74c54 100644 --- a/crates/core/flags/defs.rs +++ b/crates/core/flags/defs.rs @@ -3898,6 +3898,10 @@ When \flag{multiline} is used, a single match that spans multiple lines is only counted once for the purposes of this limit. Multiple matches in a single line are counted only once, as they would be in non-multiline mode. .sp +When combined with \flag{after-context} or \flag{context}, it's possible for +more matches than the maximum to be printed if contextual lines contain a +match. +.sp Note that \fB0\fP is a legal value but not likely to be useful. When used, ripgrep won't search anything. "