summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartijn van Duren <martijn@cvs.openbsd.org>2021-08-31 13:14:05 +0000
committerMartijn van Duren <martijn@cvs.openbsd.org>2021-08-31 13:14:05 +0000
commit80ff7c221bdd3771e51673deef6f0cc53f7ea9cb (patch)
treede229426d9d482e8ad918544f32b0524cb7268b7
parent0c08ef1d901d3c9583697ac4ddb8016a7c2ee5ca (diff)
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 <at> hacktheplanet <dot> fi). OK matthieu@
-rw-r--r--app/xterm/xterm.h2
1 files changed, 1 insertions, 1 deletions
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)