You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using both of these flags together produces the expected output, for example, 2 lines of context with 1 match, but still highlights other matches that were not included due to --max-count.
Because these matches are only being included because of --context, it's unintuitive and confusing to the user to also highlight the text for the matches that weren't actually included.
It's also fairly easy to produce a less specific test case yourself on any type of sorted data (where you are just matching the beginning and have context enabled).
What is the actual behavior?
Notice how the lines are also suffixed with : before the line number instead of -.
What is the expected behavior?
I feel like this would be much more intuitive:
I do understand that there is an argument against the behavior I am proposing, wherein a user might be confused by non-highlighted matches, but I feel like that would be encountered less often than the current behavior, and in the proposed case the issue would lie in "user has forgotten they set the --max-context flag" rather than the program's behavior being inconsistent / confusing.
The text was updated successfully, but these errors were encountered:
Please tick this box to confirm you have reviewed the above.
What version of ripgrep are you using?
How did you install ripgrep?
Homebrew
What operating system are you using ripgrep on?
Describe your bug.
Using both of these flags together produces the expected output, for example, 2 lines of context with 1 match, but still highlights other matches that were not included due to
--max-count
.Because these matches are only being included because of
--context
, it's unintuitive and confusing to the user to also highlight the text for the matches that weren't actually included.Related: #1380
What are the steps to reproduce the behavior?
Run
rg Pro -m 1 -C 2 therapeutic.txt
, you can find this file here:https://github.com/5HT2C/doses-logger/blob/master/therapeutic.txt
It's also fairly easy to produce a less specific test case yourself on any type of sorted data (where you are just matching the beginning and have context enabled).
What is the actual behavior?
Notice how the lines are also suffixed with
:
before the line number instead of-
.What is the expected behavior?
I feel like this would be much more intuitive:
I do understand that there is an argument against the behavior I am proposing, wherein a user might be confused by non-highlighted matches, but I feel like that would be encountered less often than the current behavior, and in the proposed case the issue would lie in "user has forgotten they set the
--max-context
flag" rather than the program's behavior being inconsistent / confusing.The text was updated successfully, but these errors were encountered: