Merge pull request #1538 from xonsh/fix_color_indexes

Fix color indexes on Windows
This commit is contained in:
Konstantinos Tsakiltzidis 2016-08-11 17:18:05 +03:00 committed by GitHub
commit bd9d77140e
2 changed files with 18 additions and 1 deletions

View file

@ -0,0 +1,14 @@
**Added:** None
**Changed:** None
**Deprecated:** None
**Removed:** None
**Fixed:**
* Fix a startup problem on windows caused by a refactor of Prompt_toolkit.
https://github.com/jonathanslenders/python-prompt-toolkit/commit/a9df2a2
**Security:** None

View file

@ -1271,7 +1271,10 @@ def _get_color_indexes(style_map):
for token in style_map:
attr = pt_style.token_to_attrs[token]
if attr.color is not None:
index = table.lookup_color(attr.color, attr.bgcolor)
try:
index = table.lookup_color(attr.color, attr.bgcolor)
except AttributeError:
index = table.lookup_fg_color(attr.color)
try:
rgb = (int(attr.color[0:2], 16),
int(attr.color[2:4], 16),