Skip to content

Commit

Permalink
Simplification in RichLog
Browse files Browse the repository at this point in the history
  • Loading branch information
darrenburns committed Sep 10, 2024
1 parent 9db5b5d commit 5ce0086
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/textual/widgets/_rich_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def write(
expand: Enable expand to widget width, or `False` to use `width`.
If `width` is not `None`, then `expand` will be ignored.
shrink: Enable shrinking of content to fit width.
If `width` is not `None`, then `shrink` will be ignored.
If `width` is not `None`, or `expand` is `True`, then `shrink` will be ignored.
scroll_end: Enable automatic scroll to end, or `None` to use `self.auto_scroll`.
Returns:
Expand All @@ -197,7 +197,7 @@ def write(

if width is not None:
# Use the width specified by the caller.
# Note that we ignore `expand` and `shrink` when a width is specified.
# We ignore `expand` and `shrink` when a width is specified.
render_width = width
else:
# Compute the width based on available information.
Expand All @@ -211,8 +211,7 @@ def write(
if expand:
# Expand the renderable to the width of the scrollable content region.
render_width = max(renderable_width, scrollable_content_width)

if shrink and not expand:
elif shrink:
# Shrink the renderable down to fit within the scrollable content region.
render_width = min(renderable_width, scrollable_content_width)

Expand Down

0 comments on commit 5ce0086

Please sign in to comment.