-
Notifications
You must be signed in to change notification settings - Fork 28
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
Grapheme handling issue with \r\n
#58
Comments
More generally I feel like there are a few rough edges to the
|
That one is a bit ugly. I didn't really consider windows newlines because indeed nucleo is intended for single-line matches. I guess you would want to normalize \r\n to \n instead of \r (and do that in the ascik case too). Not sure about the API. Having a Display/From/Into implementations is useful. You can shoot yourself in the foot with it but it would be unfortunate to restrict the API. Maybe some naming changes to make things more explicit could be sufficient (or improving the docs). For example I think there can be usecases where you would want to use push() manually so just removing the API isn't great. Maybe call it push_grapheme or something isntead |
Edit: See the comment in the closed PR instead: #59 (comment) But leaving the old version below for posterity.
|
Edit: See the comment in the closed PR instead: #59 (comment) But leaving the old version below for posterity.
|
There seems to be a grapheme handling ambiguity for strings containing the "windows-style newline"
\r\n
?Since
\r\n
is treated as a single grapheme by the Unicode segmentation crate, the highlight indices corresponding to aUtf32String
constructed from a string slice consisting only of ASCII characters and\r\n
will be offset relative to the grapheme indices of that string.I am curious if this is intended behaviour? If very fast reading of the implementation in helix is correct, this is also a "bug" in helix.
It is reasonable to me that helix does not support multi-line objects at all, so in practice this never turns up. I noticed this behaviour while implementing support for multi-line matches in nucleo-picker; here is the downstream PR: autobib/nucleo-picker#13
The text was updated successfully, but these errors were encountered: