is_egc_wordbreak(): portably initialize mbstate

This commit is contained in:
nick black 2020-11-29 08:17:04 -05:00
parent 4b682585b9
commit b01113941d
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

View File

@ -241,12 +241,12 @@ do_backspace(ncreader* n){
static bool
is_egc_wordbreak(ncplane* textarea){
char* egc = ncplane_at_yx(textarea, textarea->y, textarea->x, NULL, NULL);
fprintf(stderr, "TAKING A LOKO AT [%s]\n", egc);
if(egc == NULL){
return true;
}
wchar_t w;
mbstate_t mbstate = {0};
mbstate_t mbstate;
memset(&mbstate, 0, sizeof(mbstate));
size_t s = mbrtowc(&w, egc, MB_CUR_MAX, &mbstate);
free(egc);
if(s == (size_t)-1 || s == (size_t)-2){