-
Notifications
You must be signed in to change notification settings - Fork 24
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
Misaligned output #78
Comments
To be fair, while on my system it’s not that bad as above I am also having misaligned output issues. This is super hard to get right on all platforms simultaneously, the problem is that it’s really hard to predict how many cells a certain emoji is wide in the current font. |
This sounds like it's caused in kitty by kovidgoyal/kitty#3998. Kitty has a different behavior for character widths, so the sequence |
Yes, that is also my fear. But even reliably detecting in which terminal we run seems hard. I am considering to actually drop all emojis which tend to have an irregular width or at least offer an option to do so … |
There is some relevant discussion with Kovid Goyal regarding the default presentations (and thus width in cells) of certain code points: kovidgoyal/kitty#6572 (comment) TL;DR: if you are explicitly adding the text presentation selector to the output ( The trickiness is really only when you're not adding presentation selectors. For code points that have both text and emoji presentations, they each have a default presentation. Technically, which presentation to actually render is up to the environment, but in practice a terminal emulator should stick to the default presentation exactly because there is no explicit way for the program to know which presentation is being used (and thus, how wide the rendered glyph is expected to be). |
Interesting. I observed the "stuff changes if there is a whitespace behind it" behavior as well. This discussion gives me hope, that there is a principled solution to this. Will investigate when I have the time. |
Not sure if this provides any insight, but I just noticed this. I'm on mac and use iTerm. Whenever I use NOM the output is always misaligned (it looks like the picture in initial comment). I'm currently connected to NixOS from the same iTerm on the same Mac and the output looks properly aligned. So it likely might have to do with how the terminal is initialized, perhaps the selector (mentioned by @zeorin) is set differently on those systems. |
I've noticed that the nix-output-monitor/lib/NOM/Print/Table.hs Line 75 in 23d4302
The main culprits are these characters:
However, patching Another problem is that the output includes variation selectors 15 and 16 to force text and emoji presentation (respectively) of the subsequent codepoint; for some reason,
EDIT: Thanks @P1n3appl3 for pointing me to the Unicode docs on this, I had this wrong. nix-output-monitor/lib/NOM/Print.hs Lines 66 to 67 in 05d7e3d
|
@amjoseph-nixpkgs Do you mind sharing on which system you encountered this issue? I am getting the impression that wcwidth works correctly on linux but is broken when used on Mac and WSL. |
Linux, I don't run NixOS (no systemd) but I don't think that has much to do with this issue. |
I'm not quite sure why, but the overview section of the
nom build
output is always misaligned.This was tested on an M1 MacBook Pro running macOS Ventura.
It looks this way both in the official Terminal app and in iTerm 2. Changing between various fonts, even Nerd ones, also seems to have no effect.
The text was updated successfully, but these errors were encountered: