-
Notifications
You must be signed in to change notification settings - Fork 1.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
Syntax highlighting is off with unicode characters #138
Comments
Commit f730864 fixes the crash, but the underlying problem still exists, which is that unicode characters cause the indexing in Go's regexp engine to give different indices than I expect. This is related to #134. Go gives matches in byte indices (so I know the number of the byte that matches) but I want it in character indices so I know which character matches. Generally this is not a problem because in ASCII 1 byte = 1 character, but when using more unicode characters this doesn't hold true anymore. In this case the crash is caused by the double width character in the title of the document (this character: 。). |
Ahh yes, it seems like all syntax highlighting and selections are off by a few characters now. |
Have you looked at https://github.com/gdamore/tcell/blob/815826d8a7207fcc8fd33e01d9679b1cb966b2d3/_demos/unicode.go & https://github.com/mattn/go-runewidth ? I don't really know anything about this more advanced stuff, but it seems to be about these double width characters. |
Happens both when scrolling and when using the arrows, it always seems to be the same line in this particular file: https://github.com/onodera-punpun/rice/blob/gh-pages/index.html#L42
Disabling syntax highlighting stops making it crash.
The text was updated successfully, but these errors were encountered: