##// END OF EJS Templates
Python 2.7 support & highlighting in prompt_toolkit interface
Thomas Kluyver -
Show More
@@ -1,4 +1,8 b''
1 """IPython terminal interface using prompt_toolkit in place of readline"""
2 from __future__ import print_function
3
1 4 from IPython.core.interactiveshell import InteractiveShell
5 from IPython.utils.py3compat import PY3
2 6 from traitlets import Bool, Unicode, Dict
3 7
4 8 from prompt_toolkit.completion import Completer, Completion
@@ -15,7 +19,7 b' from prompt_toolkit.layout.lexers import PygmentsLexer'
15 19 from prompt_toolkit.styles import PygmentsStyle
16 20
17 21 from pygments.styles import get_style_by_name
18 from pygments.lexers import Python3Lexer
22 from pygments.lexers import Python3Lexer, PythonLexer
19 23 from pygments.token import Token
20 24
21 25
@@ -116,7 +120,7 b' class PTInteractiveShell(InteractiveShell):'
116 120 style_dict=style_overrides)
117 121
118 122 app = create_prompt_application(multiline=True,
119 lexer=PygmentsLexer(Python3Lexer),
123 lexer=PygmentsLexer(Python3Lexer if PY3 else PythonLexer),
120 124 get_prompt_tokens=self.get_prompt_tokens,
121 125 key_bindings_registry=kbmanager.registry,
122 126 history=history,
General Comments 0
You need to be logged in to leave comments. Login now