| 84 | */ |
| 85 | |
| 86 | static int git_wcwidth(ucs_char_t ch) |
| 87 | { |
| 88 | /* |
| 89 | * Sorted list of non-overlapping intervals of non-spacing characters, |
| 90 | */ |
| 91 | #include "unicode-width.h" |
| 92 | |
| 93 | /* test for 8-bit control characters */ |
| 94 | if (ch == 0) |
| 95 | return 0; |
| 96 | if (ch < 32 || (ch >= 0x7f && ch < 0xa0)) |
| 97 | return -1; |
| 98 | |
| 99 | /* binary search in table of non-spacing characters */ |
| 100 | if (bisearch(ch, zero_width, ARRAY_SIZE(zero_width) - 1)) |
| 101 | return 0; |
| 102 | |
| 103 | /* binary search in table of double width characters */ |
| 104 | if (bisearch(ch, double_width, ARRAY_SIZE(double_width) - 1)) |
| 105 | return 2; |
| 106 | |
| 107 | return 1; |
| 108 | } |
| 109 | |
| 110 | /* |
| 111 | * Pick one ucs character starting from the location *start points at, |
no test coverage detected