Don't eat commas when there's no background color or when a comma directly

follows a background color
This commit is contained in:
jesopo 2018-11-14 22:35:13 +00:00
parent ba68f33999
commit 2fc948ab24

View file

@ -162,11 +162,16 @@ def _color_tokens(s: str) -> typing.List[str]:
else:
foreground += char
continue
elif char == ",":
elif char == "," and not background:
background += char
continue
else:
matches.append("\x03%s%s" % (foreground, background))
color = foreground
if len(background) > 1:
color += background
if color:
matches.append("\x03%s" % color)
is_color = False
foreground = ""
background = ""