utf8_egc_len: work around treacherous wcwidth #903

pull/922/head
nick black 4 years ago committed by Nick Black
parent 237e5b7bc0
commit d523b41200

@ -3528,8 +3528,8 @@ makegroup(struct ncplane* title, int y, const char* emoji, const char* name){
if(bytes < 0){ if(bytes < 0){
break; break;
} }
fprintf(stderr, "PLACING %d/%d: %zu [%s]\n", y, x, strlen(cell_extended_gcluster(n, &c)), cell_extended_gcluster(n, &c));
int w = ncplane_putc_yx(n, y, x, &c); int w = ncplane_putc_yx(n, y, x, &c);
//fprintf(stderr, "PLACED %d/%d (%d): %zu [%s]\n", y, x, w, strlen(cell_extended_gcluster(n, &c)), cell_extended_gcluster(n, &c));
cell_release(n, &c); cell_release(n, &c);
if(w < 0){ if(w < 0){
ncplane_destroy(n); ncplane_destroy(n);

@ -88,7 +88,8 @@ utf8_egc_len(const char* gcluster, int* colcount){
if(iswspace(wc)){ // newline or tab if(iswspace(wc)){ // newline or tab
return ret + 1; return ret + 1;
} }
cols = 0; ret += r;
break;
} }
*colcount += cols; *colcount += cols;
} }

Loading…
Cancel
Save