3rdparty: use a newer wcwidch implementation

This commit is contained in:
李通洲
2024-01-23 10:15:32 +08:00
parent 5378d05bfb
commit 28ea765f19
8 changed files with 573 additions and 334 deletions
+9 -10
View File
@@ -2,15 +2,14 @@
#include <wchar.h>
#ifdef FF_HAVE_WCWIDTH
static inline int mk_wcwidth(wchar_t ucs) {
return wcwidth(ucs);
#ifndef FF_HAVE_WCWIDTH
#include "3rdparty/wcwidch/wcwidth.h"
static inline int wcswidth(const wchar_t *pwcs, size_t n)
{
int res = 0;
while (n-- > 0)
res += wcwidth(*pwcs++);
return res;
}
static inline int mk_wcswidth(const wchar_t *pwcs, size_t n) {
return wcswidth(pwcs, n);
}
#else
// https://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c
int mk_wcwidth(wchar_t ucs);
int mk_wcswidth(const wchar_t *pwcs, size_t n);
#endif