Don't eat commas when there's no background color or when a comma directly
follows a background color
This commit is contained in:
parent
ba68f33999
commit
2fc948ab24
1 changed files with 7 additions and 2 deletions
|
@ -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 = ""
|
||||
|
|
Loading…
Reference in a new issue