Hi Leonardo,
Sure! Here what I see with your patch applied:
% scan -format '%(decode{subject})' +. 1
mbtowc(0x20) = 1
cntrl:0 space:1 blank:1 print:1
mbtowc(0x1f576) = 4
cntrl:0 space:0 blank:0 print:0
wcwidth(0x1f576) = -1
Yeah, I think the code was assuming if it's not cntrl, and not space,
then it must be print and therefore width >= 0. But that's clearly not
true, even here, where Norm's sunglasses don't have a negative width,
e.g. U+0378.
$ test/getcwidth --ctype | grep -m1 ' -1 [^cs]*$'
378 -1 ------------
$
That does mean I can reproduce the failed assertion using that rune.
$ uip/scan -format '%(lit £)' .
£
$ uip/scan -format '%(lit )' .
scan: sbr/fmt_scan.c:280: cpstripped: Assertion `w >= 0' failed.
Sunglasses have a width of 1 here, that's why David and I don't see the
problem.
$ test/getcwidth --ctype | grep 1f576
1f576 1 -pg------@--
$
I've re-written the MULTIBYTE_ENABLED cpstripped() on git's master
branch, not the 1.7 one. Could you give it a go with what failed
before, and ideally run a `make check' and if all's well a
`NMH_VALGRIND=1 VALGRIND_ME=1 make check' to give it a work out, it
takes a while, with your different definitions of Unicode widths.
docs/README.developers explains those two variables.
--
Cheers, Ralph.
https://plus.google.com/+RalphCorderoy
_______________________________________________
Nmh-workers mailing list
Nmh-workers(_at_)nongnu(_dot_)org
https://lists.nongnu.org/mailman/listinfo/nmh-workers