ownsAnchor method

bool ownsAnchor(
  1. CellAnchor anchor
)

Whether anchor belongs to a line in this buffer.

Implementation

bool ownsAnchor(CellAnchor anchor) {
  final line = anchor.line;
  if (line == null || !line.attached) {
    return false;
  }

  final index = line.index;
  if (index < 0 || index >= lines.length) {
    return false;
  }

  return identical(lines[index], line);
}