def shorten_text(text, width):
    """Shorten text, make sure you properly account tabs

    Tabs are every 8 spaces (counted as number of chars to the next tab stop)

    Args:
        text (str): text to shorten
        width (int): length

    Returns (tuple):
        shorten text (str): shortened text
        next char (str): remainder
    """
    count = 0
    idx = 0
    for c in text:
        if count >= width:
            return (text[:idx], c)
        if c == "\t":
            count = ((count + 8) // 8) * 8  # round to neares mult of 8
            if count > width:
                return (text[:idx], c)
            idx = idx + 1
        else:
            count = count + 1
            idx = idx + 1

    return (text[:idx], "")