[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#960164: xterm: forceBoxChars mode + cjkWidth mode renders oddly



On Sun, May 10, 2020 at 01:38:51PM +1000, Timothy Allen wrote:
> Package: xterm
> Version: 356-1
> Severity: minor

:-)

> However, the box-drawing characters are "East-Asian Width: Ambiguous"
> in Unicode, so in CJK-width mode they should occupy 2 character cells,
> looking something like this:

"should" makes a lot of assumptions.  Where it falls short is that
(as far as I recall...) none of the systems' locale support can tell
an application that the width ought to be "fullwidth".

Attaching a quick demo using wcwidth -- running with all of the available
locales, it finds no occurrence of "fullwidth" line-drawing characters.

-- 
Thomas E. Dickey <dickey@invisible-island.net>
https://invisible-island.net
ftp://ftp.invisible-island.net
#define _XOPEN_SOURCE		/* See feature_test_macros(7) */
#include <stdio.h>
#include <stdlib.h>
#include <wchar.h>
#include <locale.h>

#define DATA(code,name) { code, #name }
static struct {
    wchar_t code;
    const char *name;
} table[] = {

    DATA(0x2500, box drawings light horizontal),
	DATA(0x2502, box drawings light vertical),
	DATA(0x250c, box drawings light down and right),
	DATA(0x2510, box drawings light down and left),
	DATA(0x2514, box drawings light up and right),
	DATA(0x2518, box drawings light up and left),
	DATA(0x251c, box drawings light vertical and right),
	DATA(0x2524, box drawings light vertical and left),
	DATA(0x252c, box drawings light down and horizontal),
	DATA(0x2534, box drawings light up and horizontal),
	DATA(0x253c, box drawings light vertical and horizontal),
};

int
main(int argc, char *argv[])
{
    int n;

    for (n = 1; n < argc; ++n) {
	int c;
	setlocale(LC_CTYPE, argv[n]);
	for (c = 0; c < sizeof(table) / sizeof(table[0]); ++c) {
	    int w = wcwidth(table[c].code);
	    if (w != 1) {
		printf("%s:%d:%s\n", argv[n], w, table[n].name);
	    }
	}
	setlocale(LC_CTYPE, "C");
    }
    return EXIT_SUCCESS;
}

Attachment: signature.asc
Description: PGP signature


Reply to: