Skip to content

Commit

Permalink
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/textual/widget.py
Original file line number Diff line number Diff line change
@@ -1210,16 +1210,19 @@ def post_render(self, renderable: RenderableType) -> RenderableType:
RenderableType: A new renderable.
"""

text_justify = (
_get_rich_justify(self.styles.text_align)
if self.styles.has_rule("text_align")
else None
)
if isinstance(renderable, str):
justify = _get_rich_justify(self.styles.text_align)
renderable = Text.from_markup(renderable, justify=justify)
renderable = Text.from_markup(renderable, justify=text_justify)

rich_style = self.rich_style
if isinstance(renderable, Text):
renderable.stylize(rich_style)
if not renderable.justify:
justify = _get_rich_justify(self.styles.text_align)
renderable.justify = justify
if text_justify is not None and renderable.justify is None:
renderable.justify = text_justify
else:
renderable = Styled(renderable, rich_style)

0 comments on commit c765944

Please sign in to comment.