wcwidth method
The cells codePoint takes in the terminal: 0 for a combining mark or
a control, 2 for a wide character, else 1.
Implementation
int wcwidth(int codePoint) {
if (codePoint < 32) return 0;
if (codePoint < 127) return 1;
if (codePoint < 65536) return table[codePoint];
if (bisearch(codePoint, HIGH_COMBINING)) return 0;
if (bisearch(codePoint, HIGH_WIDE)) return 2;
return 1;
}