-
-
Notifications
You must be signed in to change notification settings - Fork 126
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(graphical): Fix panic with span extending past end of line (#215) #221
Conversation
Yeah it was probably the bad behaviour. To make sure everything is correct, I've tested your patch. miette/src/handlers/graphical.rs Lines 620 to 626 in 3e25fd5
|
With the upgrade, I found another interesting case where I was pointing the span inside a unicode. v5.3.0: offset 5..7
v5.4.0: 'byte index 7 is not a char boundary; it is inside 'ⸯ' (bytes 5..8) of `var aⸯ; I had to change the span to 5..8 to cover the unicode
|
And to make things more annoying ... Although v5.4.0 is more accurate when pointing to a unicode, but the graphical reporter will use the range pointer |
To be clear, you tested input similar to the examples from #215 against this PR and are still seeing a panic? If so, could you send the input that you're seeing the panic on? The code block linked in that comment is the same one that this PR is changing: I tested the input from #215 during development of this. I was able to reproduce the panic with the |
I've created a separate issue for this: #223.
I don't think this is specific to multi-byte unicode characters. Miette currently only uses the IMO, it could go either way as to whether or not this behavior is correct. The one thing that I think is definitely not correct is that multi-byte spans with zero visual columns (for example, spanning a zero-width-space or the |
Oh I was looking at the wrong place again, I got dizzy from testing all these difference branches and versions 😵 Anyway, this PR passed all my tests (I have a JavaScript / TypeScript compiler running with all Test262 / Babel / TypeScript conformance tests). |
This also changes the behavior with spans including a CRLF line-ending. Before the panic bug was introduced, these were rendered with the CRLF being two visual columns wide. Now, any span extending past the EOL is treated as including one extra visual column. See #215 (comment) for an example of this.
This PR notably does not fix the rendering bug with spans including the EOF. These were rendered incorrectly before the panic bug was introduced. @Boshen mentioned that they were seeing a panic with EOF in #215, but I haven't been able to reproduce that. We may want to wait for a response from them before merging this, since it seems like I'm missing something here.