-
Notifications
You must be signed in to change notification settings - Fork 479
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
Correct length to endof in SubString call #530
Conversation
Any ideas whether this might fix #470? |
@mortenpi The old code was dropping characters for multibyte |
So the stricter indexing rules have already caught one bug? That's great news! |
src/Utilities/TextDiff.jl
Outdated
@@ -48,7 +48,7 @@ function splitby(reg::Regex, text::AbstractString) | |||
push!(out, SubString(text, last, each.match.offset + each.match.endof)) | |||
last = each.match.endof + each.offset | |||
end | |||
local laststr = SubString(text, last, length(text)) | |||
local laststr = SubString(text, last, endof(text)) |
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.
endof(text)
is redundant, right?
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.
right 😄
LGTM, thanks! I can confirm that it fixes #470 as well. I'll try to put out a (long overdue) patch release with this one shortly so that JuliaLang/julia#22511 could be merged. |
(cherry picked from commit ed1f8bf)
length
will fail on multibyteChar
.E.g.
This is part of the fix needed for JuliaLang/julia#22511.
Fixes #470.