mirror of
https://github.com/rfivet/uemacs.git
synced 2024-12-18 15:26:23 -05:00
Cater to wcwidth implementation difference (Cygwin: UTF-16, Linux: UTF-32).
This commit is contained in:
parent
b0362969a3
commit
e71338b261
3
main.c
3
main.c
@ -65,6 +65,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <locale.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@ -140,6 +141,8 @@ int main(int argc, char **argv)
|
||||
int errflag; /* C error processing? */
|
||||
bname_t bname ; /* buffer name of file to read */
|
||||
|
||||
setlocale( LC_CTYPE, "") ; /* wide character support (UTF-32) */
|
||||
|
||||
#if PKCODE & BSD
|
||||
sleep(1); /* Time for window manager. */
|
||||
#endif
|
||||
|
4
utf8.c
4
utf8.c
@ -11,8 +11,12 @@
|
||||
* Display width of UTF-8 character
|
||||
*/
|
||||
unsigned utf8_width( unicode_t c) {
|
||||
#ifdef CYGWIN
|
||||
assert( sizeof( wchar_t) == 2) ; /* wcwidth only handle UTF-16 */
|
||||
return (c < 0x10000) ? (unsigned) wcwidth( (wchar_t) c) : 2 ;
|
||||
#else
|
||||
return (unsigned) wcwidth( (wchar_t) c) ;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user