-
Notifications
You must be signed in to change notification settings - Fork 36
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
Support for wide characters and emojis #103
Comments
This sounds like a nice feature! I believe this would be easier to implement in the layouter than the renderer. The layouter is already somewhat output-environment-aware, via prettyprinter/prettyprinter/src/Data/Text/Prettyprint/Doc/Internal.hs Lines 1631 to 1632 in 7da3b1d
Otherwise I believe we'd need to make some big changes to As a first step, we'd need a way to get the correct character widths – is there a nice, well-maintained Haskell library for that? How does |
I see that |
You can see a bit of summary about usages in this comment.
If it would be that simple it would be nice. Unfortunately that l |
I noticed that I suspect it's too simple for your needs, @ony, but it might be worth investigating how much it would take to make it good enough. |
A simple fix would be adding an |
Currently
Data.Text.length
is used to identify length of the text in characters. But this is not true for Unicode wide characters and emojis that can occupy 2 cells on the terminal. As well some of the characters might be invisible or lead to vertical tab etc.Most likely it should be on the rendering side (e.g. HTML may use different ways to align text than spaces) and in this case it worth considering indent/column just a guideline based on other characters in layout. I.e.
(dependening on font may be rendered unaligned in browser, but should be fine in terminal)
It should mostly work fine for right alignment as long as people don't use characters to pad, but use proper
indent
. Though last character might not always be tightly attached to right side.More examples can be found in simonmichael/hledger#895
The text was updated successfully, but these errors were encountered: