-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Adjacent replaced multiline matches result in wrong line numbers #2779
Comments
This is an incomplete description of the problem you're reporting. It isn't just when a regex matches strings that are adjacent, it's also required that you use the
Indeed though, the adjacency part of this seems important. If instead I use the following haystack as
Then the line numbers change:
|
As you say, I forgot to mertion the |
I'm not proficient with Rust, but I could try to look for the problem. Any pointers on where to look? |
Likely in That's where I would start anyway. |
Please tick this box to confirm you have reviewed the above.
What version of ripgrep are you using?
ripgrep 13.0.0
-SIMD -AVX (compiled)
+SIMD +AVX (runtime)
How did you install ripgrep?
APT
What operating system are you using ripgrep on?
Kubuntu 23.10
Describe your bug.
This is similar to #2420, and I understand why that's WONTFIX. This is different though.
Using a multiline regexp, when the regexp matches strings that come immediately one after another, it bungles the line numbers of all of them. Easier to show you with a reproduction example:
What are the steps to reproduce the behavior?
Save a file
test.txt
containing:Then run
What is the actual behavior?
The result is
Only the first hit is correct.
You can see that the line numbers will be correctly reported if you modify the file to add a newline after each instance of ":end:".
What is the expected behavior?
Expected the result:
The text was updated successfully, but these errors were encountered: