mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-05 17:00:58 +01:00
Merge pull request #2735 from xonsh/fix_default_style_dict
Fix for `DEFAULT_STYLE_DICT` error on ptk2
This commit is contained in:
commit
a8f824f2a1
2 changed files with 15 additions and 6 deletions
13
news/fix-default-style-dict.rst
Normal file
13
news/fix-default-style-dict.rst
Normal 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
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue