def width_cal_preprocess(content):
    """
    此函数同时删除 ANSI escape code，避免影响行宽计算
    This function also remove ANSI escape code to avoid the influence on line width calculation
    """
    ptn = re.compile(r'(\033|\x1b)\[.*?m', re.I)
    _content = re.sub(ptn, '', content) # remove ANSI escape code
    return _content