Skip to content

Instantly share code, notes, and snippets.

@waltarix
Last active December 5, 2015 05:36
Show Gist options
  • Save waltarix/1407905 to your computer and use it in GitHub Desktop.
Save waltarix/1407905 to your computer and use it in GitHub Desktop.
zsh: Fix Ambiguous-width CJK treating problem.
diff --git a/Src/compat.c b/Src/compat.c
index 9041c0b..4d2b320 100644
--- a/Src/compat.c
+++ b/Src/compat.c
@@ -860,6 +860,7 @@ int mk_wcswidth(const wchar_t *pwcs, size_t n)
return width;
}
+#endif /* 0 */
/*
@@ -951,7 +952,6 @@ int mk_wcswidth_cjk(const wchar_t *pwcs, size_t n)
return width;
}
-#endif /* 0 */
/**/
#endif /* BROKEN_WCWIDTH && (__STDC_ISO_10646__ || __APPLE__) */
diff --git a/Src/zsh.h b/Src/zsh.h
index d3bfcef..b021ff4 100644
--- a/Src/zsh.h
+++ b/Src/zsh.h
@@ -3076,7 +3076,7 @@ typedef wint_t convchar_t;
* works on MacOS which doesn't define that.
*/
#if defined(BROKEN_WCWIDTH) && (defined(__STDC_ISO_10646__) || defined(__APPLE__))
-#define WCWIDTH(wc) mk_wcwidth(wc)
+#define WCWIDTH(wc) mk_wcwidth_cjk(wc)
#else
#define WCWIDTH(wc) wcwidth(wc)
#endif
@fumiyas
Copy link

fumiyas commented Jun 5, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment