diff --git a/configure.ac b/configure.ac index d29c132b..a7d3feb7 100644 --- a/configure.ac +++ b/configure.ac @@ -326,6 +326,11 @@ PKG_CHECK_MODULES([OPENSSL], [openssl], [ ]) ]) +dnl ** +dnl ** utf8proc +dnl ** +AC_CHECK_LIB([utf8proc], [utf8proc_version]) + dnl ** dnl ** curses checks dnl ** @@ -815,7 +820,7 @@ echo "Building with 64bit DCC support .. : $offt_64bit" echo "Building with true color support.. : $want_truecolor" echo "Building with GRegex ............. : $want_gregex" echo "Building with Capsicum ........... : $want_capsicum" - +echo "Building with utf8proc ........... : $ac_cv_lib_utf8proc_utf8proc_version" if test "x$want_otr" = "xstatic"; then echo "Building with OTR support ........ : static (in irssi binary)" elif test "x$want_otr" = "xmodule"; then diff --git a/src/core/wcwidth-wrapper.c b/src/core/wcwidth-wrapper.c index e08707e9..7b0a4def 100644 --- a/src/core/wcwidth-wrapper.c +++ b/src/core/wcwidth-wrapper.c @@ -26,6 +26,10 @@ #include "settings.h" #include "utf8.h" +#ifdef HAVE_LIBUTF8PROC +#include +#endif + /* wcwidth=2 since unicode 5.2.0 */ #define UNICODE_SQUARE_HIRAGANA_HOKA 0x1F200 @@ -35,7 +39,10 @@ enum { WCWIDTH_IMPL_AUTO = 0, WCWIDTH_IMPL_OLD, - WCWIDTH_IMPL_SYSTEM, + WCWIDTH_IMPL_SYSTEM +#ifdef HAVE_LIBUTF8PROC + ,WCWIDTH_IMPL_JULIA +#endif }; WCWIDTH_FUNC wcwidth_impl_func = mk_wcwidth; @@ -99,13 +106,23 @@ static void read_settings(void) case WCWIDTH_IMPL_SYSTEM: wcwidth_impl_func = &system_wcwidth; break; + +#ifdef HAVE_LIBUTF8PROC + case WCWIDTH_IMPL_JULIA: + wcwidth_impl_func = (WCWIDTH_FUNC) &utf8proc_charwidth; + break; +#endif } } void wcwidth_wrapper_init(void) { +#ifdef HAVE_LIBUTF8PROC + settings_add_choice("misc", "wcwidth_implementation", WCWIDTH_IMPL_AUTO, "auto;old;system;julia"); +#else settings_add_choice("misc", "wcwidth_implementation", WCWIDTH_IMPL_AUTO, "auto;old;system"); +#endif read_settings(); signal_add("setup changed", (SIGNAL_FUNC) read_settings);