1
0
mirror of https://github.com/irssi/irssi.git synced 2024-10-27 05:20:20 -04:00

add julia's utf8proc wcwidth implementation

This commit is contained in:
ailin-nemui 2018-08-23 13:16:50 +02:00
parent 0d8632943d
commit b95ce3e812
2 changed files with 24 additions and 2 deletions

View File

@ -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

View File

@ -26,6 +26,10 @@
#include "settings.h"
#include "utf8.h"
#ifdef HAVE_LIBUTF8PROC
#include <utf8proc.h>
#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);