From ff43a88e322d29db54efe4e74186ac92b2315527 Mon Sep 17 00:00:00 2001 From: martijn Date: Tue, 31 Aug 2021 13:14:04 +0000 Subject: [PATCH] Make xterm use my_wcwidth unconditionally again. CharWidth is a conditional wrapper that assumes that all wide characters in the range 32-126 and 160-255) are latin-1 characters and are identical with the unicode (UTF-8) codepoints and result in a width of 1. This is correct in so far that the names of these code-points are identical, but for SHY (soft-hyphen) the explanation of how it should be used differs between unicode and latin-1. Latin-1 assumes that it's always displayed, for unicode it should only be displayed after local grammar rules apply. This wrapper got introduced in xterm #334 and is on the short-list of Thomas Dickey to fix. Since we don't know when the next release is going to be, commit this one now, so we have it fixed before 7.0. Originally discrepency between xterm and wcwidth(3) pointed out by Lauri Tirkkonen (lauri hacktheplanet fi). OK matthieu@ --- app/xterm/xterm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/xterm/xterm.h b/app/xterm/xterm.h index 28823334c..ff884b646 100644 --- a/app/xterm/xterm.h +++ b/app/xterm/xterm.h @@ -963,7 +963,7 @@ extern void report_char_class(XtermWidget); #define WideCells(n) (((IChar)(n) >= first_widechar) ? my_wcwidth((wchar_t) (n)) : 1) #define isWideFrg(n) (((n) == HIDDEN_CHAR) || (WideCells((n)) == 2)) #define isWide(n) (((IChar)(n) >= first_widechar) && isWideFrg(n)) -#define CharWidth(n) (((n) < 256) ? (IsLatin1(n) ? 1 : 0) : my_wcwidth((wchar_t) (n))) +#define CharWidth(n) (my_wcwidth((wchar_t) (n))) #else #define WideCells(n) 1 #define CharWidth(n) (IsLatin1(n) ? 1 : 0)