File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed
Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change 2323BUILTINS = {str (name ) for name in dir (builtins ) if not name .startswith ('_' )}
2424
2525
26- def THEME ():
26+ def THEME (** kwargs ):
2727 # Not cached: the user can modify the theme inside the interactive session.
28- return _colorize .get_theme ().syntax
28+ return _colorize .get_theme (** kwargs ).syntax
2929
3030
3131class Span (NamedTuple ):
@@ -254,7 +254,10 @@ def is_soft_keyword_used(*tokens: TI | None) -> bool:
254254
255255
256256def disp_str (
257- buffer : str , colors : list [ColorSpan ] | None = None , start_index : int = 0
257+ buffer : str ,
258+ colors : list [ColorSpan ] | None = None ,
259+ start_index : int = 0 ,
260+ force_color = False ,
258261) -> tuple [CharBuffer , CharWidths ]:
259262 r"""Decompose the input buffer into a printable variant with applied colors.
260263
@@ -295,7 +298,7 @@ def disp_str(
295298 # move past irrelevant spans
296299 colors .pop (0 )
297300
298- theme = THEME ()
301+ theme = THEME (force_color = force_color )
299302 pre_color = ""
300303 post_color = ""
301304 if colors and colors [0 ].span .start < start_index :
Original file line number Diff line number Diff line change @@ -1069,7 +1069,7 @@ def handle_command_def(self, line):
10691069 def _colorize_code (self , code ):
10701070 if self .colorize :
10711071 colors = list (_pyrepl .utils .gen_colors (code ))
1072- chars , _ = _pyrepl .utils .disp_str (code , colors = colors )
1072+ chars , _ = _pyrepl .utils .disp_str (code , colors = colors , force_color = True )
10731073 code = "" .join (chars )
10741074 return code
10751075
You can’t perform that action at this time.
0 commit comments