pruneEmptyFragments function
Removes empty Fragments from container (text == '').
Always leaves at least one Fragment to keep the container valid.
Implementation
void pruneEmptyFragments(InlineContainerNode container) {
final children = container.getChildren();
if (children.length <= 1) return; // don't remove the last
children.removeWhere((c) {
if (c is FluentList || c is InlineContainerNode) return false;
return c is Fragment && c.text.isEmpty;
});
}