summaryrefslogtreecommitdiff
path: root/pith/charconv
diff options
context:
space:
mode:
authorEduardo Chappa <chappa@washington.edu>2015-03-25 20:27:02 -0600
committerEduardo Chappa <chappa@washington.edu>2015-03-25 20:27:02 -0600
commit3a9d4c01e5135f6d5b2aecdaf698d1d960387df9 (patch)
tree01b45596b7334d2f9d1298f099ca4f037f2e69b7 /pith/charconv
parent955a543f9ac3bb29b88a42d0520ac68324c2f6fa (diff)
downloadalpine-3a9d4c01e5135f6d5b2aecdaf698d1d960387df9.tar.xz
* new version 2.20.4
* If the charset of a message can not be determined, use the value set in the "Unknown Character Set" option. * Resizing setup screen will redraw screen. * Unix Alpine only. Experimental: If Alpine/Pico finds a UCS4 code in the width ambiguous zone, it will use other means to determine the width, such as call wcwidth.
Diffstat (limited to 'pith/charconv')
-rw-r--r--pith/charconv/utf8.c11
-rw-r--r--pith/charconv/utf8.h1
2 files changed, 12 insertions, 0 deletions
diff --git a/pith/charconv/utf8.c b/pith/charconv/utf8.c
index d2f34e61..29341f71 100644
--- a/pith/charconv/utf8.c
+++ b/pith/charconv/utf8.c
@@ -24,6 +24,8 @@ static char rcsid[] = "$Id: utf8.c 1184 2008-12-16 23:52:15Z hubert@u.washington
#ifdef _WINDOWS
/* wingdi.h uses ERROR (!) and we aren't using the c-client ERROR so... */
#undef ERROR
+#else
+#define _XOPEN_SOURCE
#endif
#include <system.h>
@@ -98,6 +100,15 @@ wcellwidth(UCS ucs)
#endif
}
+int
+pith_ucs4width(UCS ucs)
+{
+#ifndef _WINDOWS
+ return wcwidth((wchar_t) ucs);
+#else
+ return 0;
+#endif /* _WINDOWS */
+}
/*
* Argument is a UCS-4 wide character.
diff --git a/pith/charconv/utf8.h b/pith/charconv/utf8.h
index 5a974636..9db7c0fc 100644
--- a/pith/charconv/utf8.h
+++ b/pith/charconv/utf8.h
@@ -97,6 +97,7 @@ char *utf8_to_charset(char *, char *, int);
char *comatose(long);
char *tose(long);
void line_paint(int, struct display_line *, int *);
+int pith_ucs4width(UCS);
#if !defined(_WINDOWS) && HAVE_LANGINFO_H && defined(CODESET)
char *nl_langinfo_codeset_wrapper(void);