mirror of
https://github.com/rfivet/uemacs.git
synced 2024-12-21 00:26:27 -05:00
Improve UTF-8 display under NetBSD.
This commit is contained in:
parent
4847d8c589
commit
2f5d28a864
2
main.c
2
main.c
@ -141,7 +141,7 @@ int main(int argc, char **argv)
|
|||||||
int errflag; /* C error processing? */
|
int errflag; /* C error processing? */
|
||||||
bname_t bname ; /* buffer name of file to read */
|
bname_t bname ; /* buffer name of file to read */
|
||||||
|
|
||||||
setlocale( LC_CTYPE, "") ; /* wide character support (UTF-32) */
|
setlocale( LC_CTYPE, "en_GB.UTF-8") ; /* wide character support (UTF-32) */
|
||||||
|
|
||||||
#if PKCODE & BSD
|
#if PKCODE & BSD
|
||||||
sleep(1); /* Time for window manager. */
|
sleep(1); /* Time for window manager. */
|
||||||
|
5
utf8.c
5
utf8.c
@ -15,8 +15,9 @@ unsigned utf8_width( unicode_t c) {
|
|||||||
assert( sizeof( wchar_t) == 2) ; /* wcwidth only handles UTF-16 */
|
assert( sizeof( wchar_t) == 2) ; /* wcwidth only handles UTF-16 */
|
||||||
return (c < 0x10000) ? (unsigned) wcwidth( (wchar_t) c) : 2 ;
|
return (c < 0x10000) ? (unsigned) wcwidth( (wchar_t) c) : 2 ;
|
||||||
#elif BSD
|
#elif BSD
|
||||||
assert( sizeof( wchar_t) == 4) ; /* wcwidth should handle UTF-32 */
|
// assert( sizeof( wchar_t) == 4) ; /* wcwidth should handle UTF-32 */
|
||||||
return 1 ;
|
int ret = wcwidth( (wchar_t) c) ;
|
||||||
|
return (ret < 0) ? 1 : (unsigned) ret ;
|
||||||
#else
|
#else
|
||||||
return (unsigned) wcwidth( (wchar_t) c) ;
|
return (unsigned) wcwidth( (wchar_t) c) ;
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user