* Like utf8_width(), but guaranteed safe for use in loops that subtract * per-character widths: * * - utf8_width() sets *start to NULL on invalid UTF-8 and returns 0; * we restore the pointer and advance by one byte, returning width 1 * (matching the strlen()-based fallback in utf8_strwidth()). * * - utf8_width() returns -1 for control characters; we return 0 * (matching ut
| 2940 | * (matching utf8_strnwidth() which skips them). |
| 2941 | */ |
| 2942 | static int utf8_ish_width(const char **start) |
| 2943 | { |
| 2944 | const char *old = *start; |
| 2945 | int w = utf8_width(start, NULL); |
| 2946 | if (!*start) { |
| 2947 | *start = old + 1; |
| 2948 | return 1; |
| 2949 | } |
| 2950 | return (w < 0) ? 0 : w; |
| 2951 | } |
| 2952 | |
| 2953 | static void show_stats(struct diffstat_t *data, struct diff_options *options) |
| 2954 | { |
no test coverage detected