-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
--max-count has precedence over --after-context and --context #402
Comments
Thanks for the bug report. This is definitely a bug. But I don't think it has anything to do with precedence specifically. For example:
Notice that in the last example, the "after" context for the first match is printed correctly. Only the last match loses it. This is probably just a bug in the search code where it neglects to print the context after the last match if it decides to quit early. I'll note that
This could be a little tricky to fix. Not sure. |
Print the context if there's a context left to be printed after returning early from a search (because of --max-count). Fixes BurntSushi#402.
Print the context if there's a context left to be printed after returning early from a search (because of --max-count). Fixes #402.
I think
--after-context
(-A
) and--context
(-C
) should have the same precedence as--before-context
(-B
), when being combined with--max-count
(-m
), but they do not:From my expectations,
-B
works correctly,-C
works like-B
which is unexpected, and-A
has no effect at all.My use case is to show a colleague one instance of many repeated matches, but also with some context. If
-A
combined with-m
would yield the same result as with-B
, then my use case would have been fulfilled.I am using ripgrep-0.3.2-1.fc24.x86_64, packaged for Fedora through copr (by carlgeorge-ripgrep).
Thanks for a great program! (edit: removed trailing whitespace in code block)
The text was updated successfully, but these errors were encountered: