indexOfParagraphWithCharIndex method

int indexOfParagraphWithCharIndex(
  1. int charIndex
)

Returns the index of the paragraph that contains charIndex, or -1 if none do.

Implementation

int indexOfParagraphWithCharIndex(int charIndex) =>
    binarySearchWithCompare((e) {
      if (charIndex < e.firstCharIndex) return 1;
      if (charIndex >= e.firstCharIndex + e.text.length) return -1;
      return 0;
    });