-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
$
is not line-ending aware
#3943
Comments
According to the upstream issue, it looks like using |
Related question: is helix beholden to whatever the rust regex package decides? That is, helix could interpret |
I totally empathize with the issue here, and I absolutely agree But also, that issue has been open since 2016, so who knows how long it will take to get fixed? I'm really torn on this one. |
I get it - but consider the argument that helix is using the regex library a bit differently than most developers use a regex library. That is, file-based regex parsing is different from stream- or data-based parsing in a few ways, line termination among them*. Fundamentally they're the same thing, but an argument could be made that the implementations/usages diverge enough that it might not be completely out of line to make some changes that benefit Helix's file-based use of regex more than other uses. Just food for thought. I'm torn too but this particular issue caused me a couple hours of grief. (It was only because I saw the *Edited to clarify: the main difference is that line endings are almost always significant in file-based regex parsing, since eol is typically the "record terminator", but are only sometimes significant in stream/data-based parsing. |
I'm expecting If y'all wouldn't mind reviewing my summary here to make sure it looks right to you, that'd be great: rust-lang/regex#244 (comment) Also note that ripgrep has its own work-around for this issue (which I hope to remove once this lands in the regex engine), and it essentially works by rewriting |
This has been fixed upstream |
Yes, the issue has been fixed upstream, but reading the linked issue seems to say the fix is opt in. In order to match crln as end of line, you have to prepend a flag. In the current version, to find a comma before a line ending, the regex looks like this: Yes, technically you can get the wanted behavior with that |
Summary
In vim,
$
represents the end of the line regardless of how the line ending is encoded (specifically for this issue, CRLF vs LF). In helix,$
appears to map only to\n
.Having
$
map to the end-of-line sequence (\r\n
for CRLF encodings) would obviate the need to understand the line encoding of the file being edited, so that searches for things at the end of the line can be consistent.Reproduction Steps
/,$
- it will not be found./,\r$
- it will be found.Repeating for a file with LF line endings, step 2 will succeed, and step 3 will fail.
Platform
Linux
Terminal Emulator
blink.sh / mosh
Helix Version
22.08.1-121-g8e363178
The text was updated successfully, but these errors were encountered: