def units
import bolt@1.27.0.0/src/lsp/enc.bend as Encimport Base
73# the UTF-16 code units the first n chars of a line take; a column past the
74# line's end counts one unit a column
75def units(cs: List<&2, Char>, nn: Nat) -> Nat:
76 match cs nn:
77 case Nil{} _:
78 nn
79 case Con{_c, _t} 0n:
80 0n
81 case Con{c, t} 1n+p:
82 units.step(wide(c), units(t, p))