| 2167 | } |
| 2168 | |
| 2169 | static int pp_utf8_width(const char *start, const char *end) |
| 2170 | { |
| 2171 | int width = 0; |
| 2172 | size_t remain = end - start; |
| 2173 | |
| 2174 | while (remain) { |
| 2175 | int n = utf8_width(&start, &remain); |
| 2176 | if (n < 0 || !start) |
| 2177 | return -1; |
| 2178 | width += n; |
| 2179 | } |
| 2180 | return width; |
| 2181 | } |
| 2182 | |
| 2183 | static void strbuf_add_tabexpand(struct strbuf *sb, struct grep_opt *opt, |
| 2184 | enum git_colorbool color, int tabwidth, const char *line, |
no test coverage detected