Merge pull request #2735 from xonsh/fix_default_style_dict

Fix for `DEFAULT_STYLE_DICT` error on ptk2
This commit is contained in:
Morten Enemark Lund 2018-07-20 20:32:50 +02:00 committed by GitHub
commit a8f824f2a1
Failed to generate hash of commit
2 changed files with 15 additions and 6 deletions

View file

@ -0,0 +1,13 @@
**Added:** None
**Changed:** None
**Deprecated:** None
**Removed:** None
**Fixed:**
- ``prompt_toolkit >= 2`` will start up even if Pygments isn't present
**Security:** None

View file

@ -24,7 +24,7 @@ from prompt_toolkit.shortcuts import CompleteStyle
from prompt_toolkit.shortcuts.prompt import PromptSession
from prompt_toolkit.formatted_text import PygmentsTokens
from prompt_toolkit.styles.pygments import (style_from_pygments_cls,
style_from_pygments_dict, pygments_token_to_classname)
style_from_pygments_dict)
Token = _TokenType()
@ -115,11 +115,7 @@ class PromptToolkit2Shell(BaseShell):
style = style_from_pygments_cls(
pyghooks.xonsh_style_proxy(self.styler))
else:
style_dict = {
pygments_token_to_classname(key.__name__): value
for key, value in DEFAULT_STYLE_DICT
}
style = style_from_pygments_dict(style_dict)
style = style_from_pygments_dict(DEFAULT_STYLE_DICT)
prompt_args['style'] = style