Skip to content

Commit

Permalink
Merge pull request #4247 from xavierog/adjust-richlog-highlighter-type
Browse files Browse the repository at this point in the history
Adjust RichLog.highlighter type to allow for custom highlighters.
  • Loading branch information
willmcgugan authored Mar 2, 2024
2 parents c27a3b4 + e6631fa commit da56de9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/textual/widgets/_rich_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from typing import TYPE_CHECKING, Optional, cast

from rich.console import RenderableType
from rich.highlighter import ReprHighlighter
from rich.highlighter import Highlighter, ReprHighlighter
from rich.measure import measure_renderables
from rich.pretty import Pretty
from rich.protocol import is_renderable
Expand Down Expand Up @@ -86,7 +86,8 @@ def __init__(
"""Apply Rich console markup."""
self.auto_scroll = auto_scroll
"""Automatically scroll to the end on write."""
self.highlighter = ReprHighlighter()
self.highlighter: Highlighter = ReprHighlighter()
"""Rich Highlighter used to highlight content when highlight is True"""

self._last_container_width: int = min_width
"""Record the last width we rendered content at."""
Expand Down

0 comments on commit da56de9

Please sign in to comment.