Fix formatting bug when an empty span is not aligned to a char boundary #314
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.
This bug was originally identified in #312 (comment).
The bad output looked like this:
Another possible option for the output (other than the one I implemented) would be
I prefer pointing the
▲
at the first column of the wide char rather than the second, but can see an argument that pointing at the second column is visually communicates that the span is unaligned. I think that's pretty niche, and would be surprised if any users are generating unaligned spans on purpose.I also included a minor refactor in the PR, removing an unnecessary branch. The branch was always taken both before and after the bugfix. I can remove that bit if you want.