mergeWithNext function
Merges fragment with the Fragment immediately following in the container,
if it exists and if both have the same style.
Returns true if the merge occurred.
Implementation
bool mergeWithNext(InlineContainerNode container, Fragment fragment) {
final children = container.getChildren();
final idx = children.indexWhere((c) => c.id == fragment.id);
if (idx < 0 || idx >= children.length - 1) return false;
final next = children[idx + 1];
if (next is! Fragment || next is InlineContainerNode) return false;
FragmentOperations.mergeFragments(fragment, next);
children.removeAt(idx + 1);
return true;
}