querySegmentLeafNode method

SegmentLeafNode querySegmentLeafNode(
  1. int offset
)

Given offset, find its leaf node in document

Implementation

SegmentLeafNode querySegmentLeafNode(int offset) {
  final result = queryChild(offset);
  if (result.node == null) {
    return const SegmentLeafNode(null, null);
  }

  final line = result.node as Line;
  final segmentResult = line.queryChild(result.offset, false);
  return SegmentLeafNode(line, segmentResult.node as Leaf?);
}