summaryrefslogtreecommitdiffstats
path: root/Lib/_pyrepl/utils.py
diff options
context:
space:
mode:
authorMatt Wozniski <mwozniski@bloomberg.net>2025-05-06 09:44:49 (GMT)
committerGitHub <noreply@github.com>2025-05-06 09:44:49 (GMT)
commitfd37f1a8ad8e244ddccfc76608b02b6e29e30e16 (patch)
tree9aa78d00ccfe027913430ce9b9b053c86e38080a /Lib/_pyrepl/utils.py
parent120c9d42f278297d373096fbae035767192006d7 (diff)
downloadcpython-fd37f1a8ad8e244ddccfc76608b02b6e29e30e16.zip
cpython-fd37f1a8ad8e244ddccfc76608b02b6e29e30e16.tar.gz
cpython-fd37f1a8ad8e244ddccfc76608b02b6e29e30e16.tar.bz2
gh-133490: Fix syntax highlighting for remote PDB (#133494)
Diffstat (limited to 'Lib/_pyrepl/utils.py')
-rw-r--r--Lib/_pyrepl/utils.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/Lib/_pyrepl/utils.py b/Lib/_pyrepl/utils.py
index dd327d6..38cf6b5 100644
--- a/Lib/_pyrepl/utils.py
+++ b/Lib/_pyrepl/utils.py
@@ -23,9 +23,9 @@ IDENTIFIERS_AFTER = {"def", "class"}
BUILTINS = {str(name) for name in dir(builtins) if not name.startswith('_')}
-def THEME():
+def THEME(**kwargs):
# Not cached: the user can modify the theme inside the interactive session.
- return _colorize.get_theme().syntax
+ return _colorize.get_theme(**kwargs).syntax
class Span(NamedTuple):
@@ -254,7 +254,10 @@ def is_soft_keyword_used(*tokens: TI | None) -> bool:
def disp_str(
- buffer: str, colors: list[ColorSpan] | None = None, start_index: int = 0
+ buffer: str,
+ colors: list[ColorSpan] | None = None,
+ start_index: int = 0,
+ force_color: bool = False,
) -> tuple[CharBuffer, CharWidths]:
r"""Decompose the input buffer into a printable variant with applied colors.
@@ -295,7 +298,7 @@ def disp_str(
# move past irrelevant spans
colors.pop(0)
- theme = THEME()
+ theme = THEME(force_color=force_color)
pre_color = ""
post_color = ""
if colors and colors[0].span.start < start_index: