utf8_etc_len: flatten wcwidth negative returns

This commit is contained in:
nick black 2020-07-23 02:18:59 -04:00 committed by Nick Black
parent 858d1662eb
commit f0962fc6b5

View File

@ -84,9 +84,11 @@ utf8_egc_len(const char* gcluster, int* colcount){
if(*colcount){ // this must be starting a new EGC, exit and do not claim
break;
}
if(cols < 0 && iswspace(wc)){ // newline or tab
if(cols < 0){
if(iswspace(wc)){ // newline or tab
return ret + 1;
}
cols = 0;
return ret + 1;
}
*colcount += cols;
}