@staticmethod
def _find_last_eol(output, ind):
    """Find last newline before current position."""
    iprev = ind - 1
    while iprev >= 0:
        eolprev = output[iprev].rfind('\n')
        if eolprev != -1:
            break
        iprev -= 1
    else:
        iprev = 0
        eolprev = -1
    return iprev, eolprev
