I think it'll be easier to fill in colors, selections, and cursors by coloring in text after we've constructed just a plain set of rich text widgets and spans. We can then loop through those, split them up, and add colors and backgrounds where needed.
This will probably be more expensive than doing everything in a single pass, but it will make the code easier to reason about so it'll likely be a net positive anyway.
This will probably also be less costly once we move to an actual data structure for the text instead of just one big array.
Now that weโve moved to vxim this is no longer relevant.