of a dashed square, there is a double-width space that is copy-pasted
as U+3164 HANGUL FILLER. This is also what I obtain with GNOME Terminal
under Debian/unstable.
But under Debian/unstable, I get
abc yz
(with "z" being on the last column) with both
xterm 409-1
rxvt-unicode 9.31-3+b2
(whether I use my current config or the default config).
Then I checked consistency with wcwidth:
The wcwidth of U+3164 HANGUL FILLER is 2 under Debian 12 (bookworm)
while it is 0 under Debian/unstable. This would explain the behavior.
I can see in the glibc repository:
commit 25c9c3789ecf35a5dc303261abcef7993112017d
Author: Jules Bertholet <julesbertholet@quoi.xyz>
Date: 2024-02-23 20:54:57 +0000
localedata: Fix several issues with the set of characters considered 0-width [BZ #31370]
= `Default_Ignorable_Code_Point`s should have width 0 =
Unicode specifies (https://www.unicode.org/faq/unsup_char.html#3) that characters
with the `Default_Ignorable_Code_Point` property
> should be rendered as completely invisible (and non advancing, i.e. “zero width”),
if not explicitly supported in rendering.
Hence, `wcwidth()` should give them all a width of 0, with two exceptions:
- the soft hyphen (U+00AD SOFT HYPHEN) is assigned width 1 by longstanding precedent
- U+115F HANGUL CHOSEONG FILLER needs a carveout
due to the unique behavior of the conjoining Korean jamo characters.
One composed Hangul "syllable block" like 퓛
is made up of two to three individual component characters, or "jamo".
These are all assigned an `East_Asian_Width` of `Wide`
by Unicode, which would normally mean they would all be assigned
width 2 by glibc; a combination of (leading choseong jamo) +
(medial jungseong jamo) + (trailing jongseong jamo) would then have width 2 + 2 + 2 = 6.
However, glibc (and other wcwidth implementations) special-cases jungseong and jongseong,
assigning them all width 0,
to ensure that the complete block has width 2 + 0 + 0 = 2 as it should.
U+115F is meant for use in syllable blocks
that are intentionally missing a leading jamo;
it must be assigned a width of 2 even though it has no visible display
to ensure that the complete block has width 2.
However, `wcwidth()` currently (before this patch)
incorrectly assigns non-zero width to
U+3164 HANGUL FILLER and U+FFA0 HALFWIDTH HANGUL FILLER;
this commit fixes that.
Unicode spec references:
- Hangul: §3.12 https://www.unicode.org/versions/Unicode15.0.0/ch03.pdf#G24646 and
§18.6 https://www.unicode.org/versions/Unicode15.0.0/ch18.pdf#G31028
- `Default_Ignorable_Code_Point`: §5.21 https://www.unicode.org/versions/Unicode15.0.0/ch05.pdf#G40095.
[...]
where BZ #31370 is at
https://sourceware.org/bugzilla/show_bug.cgi?id=31370
This fix was included in glibc 2.40:
https://sourceware.org/pipermail/libc-alpha/2024-July/158467.html
The GNU C Library version 2.40 is now available
[...]
[31370] localedata: wcwidth() does not treat
DEFAULT_IGNORABLE_CODE_POINTs as zero-width
[...]
So it seems that your Ubuntu release is too old.
I suppose that the behavior of GNOME Terminal under Debian/unstable
is a bug (perhaps it is assuming the old, buggy glibc behavior).
Now, concerning GNU Screen, I recall that I get
12345678901234567890
x ya
bc
with my current xterm options, but I get
12345678901234567890
x ab
c
with the xterm default options, which is also incorrect.
I suppose that's the reverseWrap option that makes the
difference (unset by default, but I set it in my config
as it gives a better behavior).
With a TrueType font, in both cases, there is a dashed square
around the "x".