Separator: support Unicode / double width separator string

Fixes #504
This commit is contained in:
李通洲
2023-07-31 14:10:53 +08:00
parent f906d02720
commit b4d1c97d2c
7 changed files with 399 additions and 18 deletions
+21
View File
@@ -0,0 +1,21 @@
#pragma once
#ifndef FF_INCLUDED_UTIL_WCWIDTH_H
#define FF_INCLUDED_UTIL_WCWIDTH_H
#include <wchar.h>
#ifdef FF_HAVE_WCWIDTH
static inline int mk_wcwidth(wchar_t ucs) {
return wcwidth(ucs);
}
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
#endif