Add a mode to the renderer to substitute *anything* outside of the ASCII space#402
Open
estebank wants to merge 1 commit intorust-lang:mainfrom
Open
Add a mode to the renderer to substitute *anything* outside of the ASCII space#402estebank wants to merge 1 commit intorust-lang:mainfrom
estebank wants to merge 1 commit intorust-lang:mainfrom
Conversation
…CII space When encountering some non-printable Unicode characters, we replace them with printable representations of them. This replacement still relies on Unicode support on the user's terminal. In order to enable use on... less modern systems, added a `force_ascii` mode to the renderer that replaces anything outside of the ASCII with a replacement string: ``` error: oops --> <current file>:2:8 | 2 | Second oops <SOH> line | ^^^^ oops ``` This change unearthed a latent bug where the rendered snippet gets out of sync with the `Annotation` lo and hi char position, making highlighting spans that had characters replaced with a different number of bytes to be improperly highlighted.
Contributor
|
Generally, I find it helpful to discuss things first in issues so conversations don't get fragmented and can be found where people expected them. I just noticed we don't have the contrib guide specifically requesting that.
Could you provide more context on the end-user concerns that this is addressing? What types of terminals are we talking about? Why is this coming up now? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When encountering some non-printable Unicode characters, we replace them with printable Unicode representations of them. This replacement still relies on Unicode support on the user's terminal. In order to enable use on... less modern systems, added a
force_asciimode to the renderer that replaces anything outside of the ASCII with a replacement string:instead of the current
This change unearthed a latent bug where the rendered snippet gets out of sync with the
Annotationlo and hi char position, making highlighting spans that had characters replaced with a different number of bytes to be improperly highlighted, as noted in thesvgtest.