janlelis/unicode-display_width

Print width of "\u{2E3A}" and "\u{2E3B}"

kuerbis opened this issue · 3 comments

As far as I can see*, the graphic character width of "\u{2E3A}" and "\u{2E3B}" are 2 and 3, but the print width in the terminal is 1.

#!/usr/bin/ruby

puts "|" + "-"        * 6 + "|||";
puts "|" + "\u{2E3B}" * 6 + "|||";
puts "|" + "\u{0bf8}" * 6 + "|||";

puts "\n";
puts "|" + "\u{2E3B}"  + " " * 3 + "|||";
puts "|" + "\u{0bf8}"  + " " * 3 + "|||";

* Deepin Terminal, GNOME-Terminal, Guake Terminal, Kitty, Konsole, LXTerminal, Sakura, Terminal, Terminator, Tilda, Xfce-Terminal, XTerm, Yakuake

Hi @kuerbis,
thanks for bringing this up. Do you have some more info / links on the different methods of measuring width (graphic width vs print width)? Seems to me like it is treated incorrectly by the terminal emulators, but I would like to know more about this.

Hi, as far as I know there are three widths: 0, 1, and 2. On the other hand, I've noticed that there are some characters that don't fit in the spaces allotted to them from the terminal. That prompted me to look to see if these signs are such.
Unfortunately I have no further information on this.

Closing; should probably be fixed directly in the terminal emulators