fix readline calculation bug with escape sequence in colored mode