diff options
author | Thijs Schreijer <thijs@thijsschreijer.nl> | 2024-06-20 22:43:06 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-20 22:43:06 +0200 |
commit | c1a64c1b75f97cef97965b3bd9a941564a6270bd (patch) | |
tree | b9a92dff6462abd5859c3c76f19748fad5d6c025 /src/wcwidth.h | |
parent | 47c24eed0191f8f72646be63dee94ac2b35eb062 (diff) | |
parent | b87e6d6d762ee823e81dd7a8984f330eb4018fd8 (diff) | |
download | luasystem-c1a64c1b75f97cef97965b3bd9a941564a6270bd.tar.gz luasystem-c1a64c1b75f97cef97965b3bd9a941564a6270bd.tar.bz2 luasystem-c1a64c1b75f97cef97965b3bd9a941564a6270bd.zip |
Merge pull request #21 from lunarmodules/terminal
Diffstat (limited to '')
-rw-r--r-- | src/wcwidth.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/wcwidth.h b/src/wcwidth.h new file mode 100644 index 0000000..f2fee11 --- /dev/null +++ b/src/wcwidth.h | |||
@@ -0,0 +1,21 @@ | |||
1 | // wcwidth.h | ||
2 | |||
3 | // Windows does not have a wcwidth function, so we use compatibilty code from | ||
4 | // http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c by Markus Kuhn | ||
5 | |||
6 | #ifndef MK_WCWIDTH_H | ||
7 | #define MK_WCWIDTH_H | ||
8 | |||
9 | |||
10 | #ifdef _WIN32 | ||
11 | #include <stdint.h> | ||
12 | typedef uint32_t mk_wchar_t; // Windows wchar_t can be 16-bit, we need 32-bit | ||
13 | #else | ||
14 | #include <wchar.h> | ||
15 | typedef wchar_t mk_wchar_t; // Posix wchar_t is 32-bit so just use that | ||
16 | #endif | ||
17 | |||
18 | int mk_wcwidth(mk_wchar_t ucs); | ||
19 | int mk_wcswidth(const mk_wchar_t *pwcs, size_t n); | ||
20 | |||
21 | #endif // MK_WCWIDTH_H | ||