def METHOD_NAME(self, index, text):
    lines = self.lineIndices()
    left = 0
    right = len(lines)
    while (right - left) > 1:
        mid = (right + left) // 2
        lineStart = lines[mid]
        if index < lineStart:
            right = mid
        elif index > lineStart:
            left = mid
        else:
            return mid
    return left