displayColumns function
Display width of a string, in terminal-style columns.
East Asian Wide and Fullwidth code points are two columns, everything else one. A combining mark is still one column of its own (there is no zero-width handling), so a decomposed Vietnamese letter measures wider than its precomposed form, exactly as it did when checks counted code points. Emoji are not counted wide.
The one implementation behind width_budget and length_ratio: a slot cap
and a length ratio are both about how much room a string takes, and two
definitions would let a Korean label pass one and trip the other.
Implementation
int displayColumns(String value) {
var columns = 0;
for (final r in value.runes) {
columns += _isWide(r) ? 2 : 1;
}
return columns;
}