fix ee_read_char to handle ^@ properly

original commit: e962a03987470d0a3937446c10af3a94793ffc43
This commit is contained in:
5pyd3r 2016-12-05 14:30:26 +10:00 committed by Bob Burger
parent 2647c0df24
commit 0df195f066
2 changed files with 11 additions and 5 deletions

2
LOG
View File

@ -1385,3 +1385,5 @@
s/update-revision, BUILDING
- export `ee-backward-delete-sexp` binding in the expression-editor module.
expeditor.ss
- fix ee_read_char to handle ^@ properly
expeditor.c

View File

@ -691,11 +691,15 @@ static ptr s_ee_read_char(IBOOL blockp) {
#endif /* PTHREADS */
if (n == 1) {
old_locale = uselocale(term_locale);
sz = mbrtowc(&wch, buf, 1, &term_out_mbs);
uselocale(old_locale);
if (sz == 1) {
return Schar(wch);
if (buf[0] == '\0') {
return Schar('\0');
} else {
old_locale = uselocale(term_locale);
sz = mbrtowc(&wch, buf, 1, &term_out_mbs);
uselocale(old_locale);
if (sz == 1) {
return Schar(wch);
}
}
}