Skip to content

Commit 6685d81

Browse files
Support mixed styles (containing ':'). Fixes bug in latest prompt-toolkit.
1 parent 7f95170 commit 6685d81

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

pymux/style.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"""
44
from __future__ import unicode_literals
55
from prompt_toolkit.styles import style_from_dict, Style, Attrs
6+
from prompt_toolkit.styles.utils import split_token_in_parts, merge_attrs
67
from prompt_toolkit.token import Token
78

89
__all__ = (
@@ -77,6 +78,12 @@ def __init__(self):
7778
self._token_to_attrs_dict = None
7879

7980
def get_attrs_for_token(self, token):
81+
result = []
82+
for part in split_token_in_parts(token):
83+
result.append(self._get_attrs_for_token(part))
84+
return merge_attrs(result)
85+
86+
def _get_attrs_for_token(self, token):
8087
if token and token[0] == 'C':
8188
# Token starts with ('C',). Token describes its own style.
8289
c, fg, bg, bold, underline, italic, blink, reverse = token

0 commit comments

Comments
 (0)