Show More
@@ -3,6 +3,7 b'' | |||||
3 | import asyncio |
|
3 | import asyncio | |
4 | import os |
|
4 | import os | |
5 | import sys |
|
5 | import sys | |
|
6 | import inspect | |||
6 | from warnings import warn |
|
7 | from warnings import warn | |
7 | from typing import Union as UnionType, Optional |
|
8 | from typing import Union as UnionType, Optional | |
8 |
|
9 | |||
@@ -66,8 +67,8 b' from .shortcuts.auto_suggest import (' | |||||
66 | PTK3 = ptk_version.startswith('3.') |
|
67 | PTK3 = ptk_version.startswith('3.') | |
67 |
|
68 | |||
68 |
|
69 | |||
69 |
class _NoStyle(Style): |
|
70 | class _NoStyle(Style): | |
70 |
|
71 | pass | ||
71 |
|
72 | |||
72 |
|
73 | |||
73 | _style_overrides_light_bg = { |
|
74 | _style_overrides_light_bg = { | |
@@ -84,6 +85,20 b' _style_overrides_linux = {' | |||||
84 | Token.OutPromptNum: '#ansired bold', |
|
85 | Token.OutPromptNum: '#ansired bold', | |
85 | } |
|
86 | } | |
86 |
|
87 | |||
|
88 | ||||
|
89 | def _backward_compat_continuation_prompt_tokens(method, width: int, *, lineno: int): | |||
|
90 | """ | |||
|
91 | Sagemath use custom prompt and we broke them in 8.19. | |||
|
92 | """ | |||
|
93 | sig = inspect.signature(method) | |||
|
94 | if "lineno" in inspect.signature(method).parameters or any( | |||
|
95 | [p.kind == p.VAR_KEYWORD for p in sig.parameters.values()] | |||
|
96 | ): | |||
|
97 | return method(width, lineno=lineno) | |||
|
98 | else: | |||
|
99 | return method(width) | |||
|
100 | ||||
|
101 | ||||
87 | def get_default_editor(): |
|
102 | def get_default_editor(): | |
88 | try: |
|
103 | try: | |
89 | return os.environ['EDITOR'] |
|
104 | return os.environ['EDITOR'] | |
@@ -764,7 +779,9 b' class TerminalInteractiveShell(InteractiveShell):' | |||||
764 | "message": get_message, |
|
779 | "message": get_message, | |
765 | "prompt_continuation": ( |
|
780 | "prompt_continuation": ( | |
766 | lambda width, lineno, is_soft_wrap: PygmentsTokens( |
|
781 | lambda width, lineno, is_soft_wrap: PygmentsTokens( | |
767 |
|
|
782 | _backward_compat_continuation_prompt_tokens( | |
|
783 | self.prompts.continuation_prompt_tokens, width, lineno=lineno | |||
|
784 | ) | |||
768 | ) |
|
785 | ) | |
769 | ), |
|
786 | ), | |
770 | "multiline": True, |
|
787 | "multiline": True, |
@@ -34,7 +34,7 b' which defines the defaults. The required interface is like this:' | |||||
34 | :class:`~.TerminalInteractiveShell` instance. |
|
34 | :class:`~.TerminalInteractiveShell` instance. | |
35 |
|
35 | |||
36 | .. method:: in_prompt_tokens(cli=None) |
|
36 | .. method:: in_prompt_tokens(cli=None) | |
37 |
continuation_prompt_tokens(self, |
|
37 | continuation_prompt_tokens(self, width=None) | |
38 | rewrite_prompt_tokens() |
|
38 | rewrite_prompt_tokens() | |
39 | out_prompt_tokens() |
|
39 | out_prompt_tokens() | |
40 |
|
40 |
General Comments 0
You need to be logged in to leave comments.
Login now