findNodeManagesPosition method

EquationRowNode findNodeManagesPosition(
  1. int position
)

Implementation

EquationRowNode findNodeManagesPosition(int position) {
  var curr = root;
  var lastEqRow = root.value as EquationRowNode;
  while (true) {
    final next = curr.children.firstWhereOrNull(
      (child) => child == null
          ? false
          : child.range.start <= position && child.range.end >= position,
    );
    if (next == null) break;
    if (next.value is EquationRowNode) {
      lastEqRow = next.value as EquationRowNode;
    }
    curr = next;
  }
  // assert(curr.value is EquationRowNode);
  return lastEqRow;
}