mirror of
https://github.com/dankamongmen/notcurses.git
synced 2024-11-04 06:00:30 +00:00
is_egc_wordbreak(): portably initialize mbstate
This commit is contained in:
parent
4b682585b9
commit
b01113941d
@ -241,12 +241,12 @@ do_backspace(ncreader* n){
|
|||||||
static bool
|
static bool
|
||||||
is_egc_wordbreak(ncplane* textarea){
|
is_egc_wordbreak(ncplane* textarea){
|
||||||
char* egc = ncplane_at_yx(textarea, textarea->y, textarea->x, NULL, NULL);
|
char* egc = ncplane_at_yx(textarea, textarea->y, textarea->x, NULL, NULL);
|
||||||
fprintf(stderr, "TAKING A LOKO AT [%s]\n", egc);
|
|
||||||
if(egc == NULL){
|
if(egc == NULL){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
wchar_t w;
|
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);
|
size_t s = mbrtowc(&w, egc, MB_CUR_MAX, &mbstate);
|
||||||
free(egc);
|
free(egc);
|
||||||
if(s == (size_t)-1 || s == (size_t)-2){
|
if(s == (size_t)-1 || s == (size_t)-2){
|
||||||
|
Loading…
Reference in New Issue
Block a user