#4216·rich

Console.print(text) silently drops Text's own justify unless justify= is also passed to print()

Author: tritsystemCreated Sep 4, 2026Updated Sep 5, 2026

AI disclosure (per AI_POLICY.md): this was investigated and written with the assistance of Claude (Anthropic). I independently reproduced it against a fresh clone of main myself before filing — repro below, runnable standalone, no dependencies beyond Rich itself.

Summary

A Text object's own .justify attribute is silently dropped when the Text is passed directly as a top-level argument to Console.print(), unless justify= is also passed to print() itself — even though Text.__rich_console__ documents/implements self.justify as taking priority over the console-level default.

Reproduction

python
from rich.console import Console
from rich.text import Text
import io

buf1 = io.StringIO()
Console(file=buf1, width=20).print(Text("hi", justify="center"))
print(repr(buf1.getvalue()))
# -> 'hi\n'                    <- not centered, despite Text's own justify="center"

buf2 = io.StringIO()
Console(file=buf2, width=20).print(Text("hi", justify="center"), justify="center")
print(repr(buf2.getvalue()))
# -> '         hi         \n'  <- only works if justify is ALSO passed to print()

Root cause

Console._collect_renderables() (rich/console.py:1550-1554, inside check_text()) funnels every Text object through:

python
sep_text = Text(sep, justify=justify, end=end)   # justify = print()'s own kwarg, default None
append(sep_text.join(text))

Text.join() (rich/text.py:788) builds the merged result via self.blank_copy(), where self is the separator sep_text — so the joined result inherits the separator's justify/overflow/no_wrap, silently clobbering whatever the joined-in Text's own .justify was set to.

The same Text object centers correctly when wrapped in Panel(...) or Group(...), because those containers call console.render() on the inner Text directly, bypassing this join path — so the bug is specific to passing a Text as a direct top-level argument to Console.print().

Checked

gh search issues --repo Textualize/rich for "justify" (30+ related hits reviewed) — found related-but-distinct issues (#460 console.log missing a justify kwarg entirely, fixed 2020; #3948/#4021 Table title justify with soft_wrap) but nothing matching this specific "Text.justify silently dropped by print()" defect. Appears unreported.

Happy to put together a PR (something like: preserve the joined item's own justify/overflow/no_wrap when it's a single Text and print()'s own justify wasn't explicitly passed) if this is confirmed as worth fixing.