lookupLine method

LookupResult lookupLine (
  1. int offset
)

Returns LineNode located at specified character offset.

Implementation

LookupResult lookupLine(int offset) {
  // TODO: prevent user from moving caret after last line-break.
  var result = _root.lookup(offset, inclusive: true);
  if (result.node is LineNode) return result;
  BlockNode block = result.node;
  return block.lookup(result.offset, inclusive: true);
}