Currently the fragment generation code (as well as caret collection, whitespace collection, decoration collection, etc.) have grown to become very complex. There should be a fuzz test that generates random text, carets, folded regions, soft line breaks, decorations, etc. to validate the fragment generation code and make sure they don't break.