Skip to content
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

Fix repl_splitter for first char in newline being non-ascii #34

Merged
merged 2 commits into from
Aug 30, 2019

Conversation

sebastianpech
Copy link
Contributor

Fixes StringIndexError in consolelexer when the first character after a linebreak is a non-ascii character.

In the original code prevind(s, i - 1), i-1 had no effect for non-ascii characters because i-1 gives an invalid index that is still within the character.

julia> prevind("abβc",5)
3

julia> prevind("abβc",5-1)
3

So to go back 2 indices this must be replaced with prevind(s, i, 2).

@KristofferC
Copy link
Member

Would be good with a test (added to https://github.com/JuliaDocs/Highlights.jl/blob/master/test/lexers/jlcon.jl).

@mortenpi mortenpi added the bug label Aug 30, 2019
@mortenpi mortenpi added this to the 0.4.2 milestone Aug 30, 2019
@mortenpi
Copy link
Member

LGTM, thanks!

@mortenpi mortenpi merged commit e9d3b92 into JuliaDocs:master Aug 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants