| 472 | } |
| 473 | |
| 474 | int strwidth(const char *s) |
| 475 | { |
| 476 | char32_t c; |
| 477 | int w = 0; |
| 478 | |
| 479 | while (int l = utf8towc(&c, s)) |
| 480 | { |
| 481 | s += l; |
| 482 | int cw = wcwidth(c); |
| 483 | if (cw != -1) // shouldn't ever happen |
| 484 | w += cw; |
| 485 | } |
| 486 | |
| 487 | return w; |
| 488 | } |
| 489 | |
| 490 | int strwidth(const string &s) |
| 491 | { |
no test coverage detected