about summary refs log tree commit diff
path: root/Src/compat.c
diff options
context:
space:
mode:
authorJoshua Rubin <joshua@rubixconsulting.com>2016-11-29 00:42:28 -0700
committerPeter Stephenson <pws@zsh.org>2016-11-29 17:19:53 +0000
commit596ba302e6f23089e58ff05d75fedfca8e79a7d2 (patch)
treebcb6eed9607546237569565b46e68fc4bff01cce /Src/compat.c
parent110ffae9fefa1367af4fdcc90a456de23b92436c (diff)
downloadzsh-596ba302e6f23089e58ff05d75fedfca8e79a7d2.tar.gz
zsh-596ba302e6f23089e58ff05d75fedfca8e79a7d2.tar.xz
zsh-596ba302e6f23089e58ff05d75fedfca8e79a7d2.zip
40037: Unicode 9 character width support.
Enable with --enable-unicode9.
Diffstat (limited to 'Src/compat.c')
-rw-r--r--Src/compat.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/Src/compat.c b/Src/compat.c
index 81afd4dfd..02412b34f 100644
--- a/Src/compat.c
+++ b/Src/compat.c
@@ -635,7 +635,18 @@ strtoul(nptr, endptr, base)
 #endif /* HAVE_STRTOUL */
 
 /**/
-#if defined(BROKEN_WCWIDTH) && (defined(__STDC_ISO_10646__) || defined(__APPLE__))
+#ifdef ENABLE_UNICODE9
+#include "./wcwidth9.h"
+int
+mk_wcwidth(wchar_t ucs)
+{
+  int w = wcwidth9(ucs);
+  if (w < -1)
+    return 1;
+  return w;
+}
+
+#elif defined(BROKEN_WCWIDTH) && (defined(__STDC_ISO_10646__) || defined(__APPLE__))
 
 /*
  * This is an implementation of wcwidth() and wcswidth() (defined in