# cells
Decode a UTF-8 string into display cells: a vector of
`@{char-index char-string width}` entries, one per codepoint.
`char-index` is the codepoint position (the same coordinate as
`len`/`slice`/`nth`), `char-string` is the codepoint as a string, and
`width` is its display width in terminal cells (East Asian Wide = 2,
see width). The editor's row renderer walks this to draw text
and map cursor columns; use the same shape anywhere you lay text out
column-wise.
## Syntax
[cells $string]
## Examples
[cells "a中c"] # @{ @{ 0 "a" 1 } @{ 1 "中" 2 } @{ 2 "c" 1 } } for c [cells $line] { [draw/cell $ctx $sx $row [nth $c 1] $fg] set sx ($sx + [nth $c 2]) }
## Returns
Vector of `@{char-index char-string width}` triples. Invalid UTF-8
bytes become width-1 cells holding the raw byte.
## See Also
`width`, `len`, `nth`, `draw/cell`