MCPcopy Index your code
hub / github.com/git/git / git_wcwidth

Function git_wcwidth

utf8.c:86–108  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

84 */
85
86static 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,

Callers 1

utf8_widthFunction · 0.85

Calls 1

bisearchFunction · 0.85

Tested by

no test coverage detected