tools: Ignore unfinished ascii escape codes.

- Ignore if the code doesn't end in 'm'.
This commit is contained in:
Andrew Hamilton 2019-07-21 23:00:35 +10:00
parent 7f9e572a18
commit ee27439a7c
2 changed files with 7 additions and 1 deletions

View file

@ -170,7 +170,10 @@ class TermStr(collections.UserString):
end_index = part.index("K")
codes = []
else:
end_index = part.index("m")
try:
end_index = part.index("m")
except ValueError:
continue
codes = part[1:end_index].split(";")
previous_code = None
for index, code in enumerate(codes):