def linenr_column_line(text, offset):
    """Return line number, column and the whole line
    in which text[offset] lies.
    Line number and column are in one-based indexing.
    Each tab is counted as one column.
    """

    offset = min(max(0, offset), len(text))
    textbegin = text[:offset]
    if not textbegin:
        return 1, 1, None
    lines = textbegin.splitlines(True)
    linenr, column = max(1, len(lines)), len(lines[-1]) + 1
    line = lines[-1]
    nlpos = text.find('\n', offset)
    if nlpos >= 0:
        line += text[offset:nlpos+1]
    else:
        line += text[offset:]
    return linenr, column, line