-
-
Notifications
You must be signed in to change notification settings - Fork 118
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
Weird tab character rendering #73
Comments
sigh. I guess we have to use @jlkiri can I interest you in filing a PR to add this to the graphical renderer? |
Ok, I'll take a look at the code! (Btw I temporarily deal with this by simply replacing tabs with spaces before rendering) |
So it turned up to be more complicated than I expected. I figured out that Anyway while I was doing this I thought that it might be best to have an option |
Oh I love that. Maybe call it |
I'm using
miette
in a parser that deals with tab\t
indents and so far noticed the following:miette
renders one\t
as the number of spaces configured in the terminal (OK)miette
counts one\t
's width as equal to one space and displays the arrow/label according to this width (Breaks because of the above, but should be possible to deal with by the developer)So I decided to calculate number of tabs in the line, multiply it by tab width, and add that to the offset minus the number of tabs. Example:
\t\t
with tab width 4 = 8SourceSpan
(16, 0)In my repro this places the arrow in the correct position. But weird stuff happens if I have a really big offset (exactly 37 and more chars). It either just renders the line without rendering arrow/label or simply panics with this error:
Here's a reproduction:
https://github.com/jlkiri/miette-tab-error-repro
The text was updated successfully, but these errors were encountered: