-
-
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
Windows eol anchor option #929
Conversation
There are also some stylistic issues you will probably want to weigh in on, e.g. whether the flag name is appropriate. |
Thanks for working on this! I'm not sure when I'll get a chance to look at this. I'm also not 100% sold on this particular approach. |
I don't think it's ideal, which is why I hid it behind a long feature flag. But I think it's a lot better than nothing; the current behavior renders |
An alternate API would be to have something like
|
It appears that on Windows, but on no other supported platform, the test framework requires one or more explicit paths to search (e.g. using |
// If `$` occurs at the end (or beginning), an empty | ||
// split-element will be created, causing the `join` to | ||
// perform the desired insertion at the correct location. | ||
pat.split('$').collect::<Vec<&str>>().join(r"\r?$") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be done by parsing the regex and doing a substitution at the HIR level.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BurntSushi That seems sensible. Are you more amenable to the configuration-option design now, then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not particularly... I just happened to see this particular issue in passing.
Honestly, this just isn't a priority for me now, and it needs thought.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand it's not a priority for you, but as I mentioned when I opened the original issue, it makes $
essentially useless on Windows.
I agree that the right solution requires thought, and I can understand why you wouldn't want to introduce a half-baked solution just to deprecate it later. On the other hand, my suggested solution is extremely simple to implement and, I expect, to maintain, and personally I think it is reasonable to introduce command-line options that may be deprecated in favor of a better solution with a warning that this is the case.
I suppose that if you're definitely opposed to a partial solution, I can just continue to maintain my fork until there's a better solution ready to ship, but I don't want to publish a competing crate on Cargo or anything like that, so it's not terribly convenient.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've heard you.
but I don't want to publish a competing crate on Cargo or anything like that, so it's not terribly convenient
If it's on GitHub, cargo install
can install straight from the git repo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I didn't know that. That's helpful; I'll try that out. Thank you.
Closing due to this comment in #416 indicating that this will be handled in libripgrep. |
Potential fix for #416 via a command-line option.
I decided it would be a good time to implement my old suggestion of just providing a command-line argument to modify the search pattern(s) now that there is config file support.
I've tested by hand that this works as expected on Windows, and the regression test I've added works on Linux.
However, the regression test fails on Windows with no information other than that the exit-code is
1
. Is there some problem with the test framework?Here's the complete output from running the test on Windows: