diff --git a/rich/syntax.py b/rich/syntax.py index d8214c3c4..cff8fd235 100644 --- a/rich/syntax.py +++ b/rich/syntax.py @@ -221,7 +221,7 @@ class _SyntaxHighlightRange(NamedTuple): style: StyleType start: SyntaxPosition end: SyntaxPosition - before: bool = False + style_before: bool = False class Syntax(JupyterMixin): @@ -793,7 +793,7 @@ def _apply_stylized_ranges(self, text: Text) -> None: newlines_offsets, stylized_range.end ) if start is not None and end is not None: - if stylized_range.before: + if stylized_range.style_before: text.stylize_before(stylized_range.style, start, end) else: text.stylize(stylized_range.style, start, end) diff --git a/rich/traceback.py b/rich/traceback.py index 2d49b6f0a..39ae35566 100644 --- a/rich/traceback.py +++ b/rich/traceback.py @@ -767,7 +767,7 @@ def render_locals(frame: Frame) -> Iterable[ConsoleRenderable]: if __name__ == "__main__": # pragma: no cover - install() + install(show_locals=True) import sys def bar(