findPredecessorFragment function
Finds the nearest non-empty plain Fragment predecessor of the element at
index in flat. Returns null if none exists.
A "plain" Fragment is one that is not an InlineContainerNode.
Implementation
Fragment? findPredecessorFragment(List<FNode> flat, int index) {
for (int i = index - 1; i >= 0; i--) {
final f = flat[i];
if (f is Fragment && f is! InlineContainerNode && f.text.isNotEmpty) {
return f;
}
}
return null;
}