···88so, our parser needs to output 2 things:
99 - {text,facets} (though, while typing, we only need to fully compute the grapheme length of the text)
1010 - list of spans to highlight in the input
1111+1212+1313+so like, as our markup parser runs, we want to be uhh
1414+- as we consume segments from the input, we push them to the overlay segments list, with styles. so like [i]test[/i] pushes segments like
1515+ {text: "[i]", class:"syntax"}
1616+ {text: "test", class:"italic"}
1717+ {text: "[/i]", class:"syntax"}
1818+ the "syntax" class is special because it indicates strongly that hey this is NOT going to affect output length linearly. wheras the well generally non-syntax text spans will be propagated directly to the output. so to those, we apply styles that indicate how they will be rendered.
1919+2020+- at the same time, we are generating a list of spans. these will have a structure like:
2121+ {text: "test", features:[{$type:TBD, style:"italic", surround:["/","/"]}]}
2222+- then, we process these spans into windows, as before, except with surround instead of strip. after the windows are generated, is when we turn surround into strip. (by inserting the chars at the start/end of each segment, and setting strip to their length)