fix log jusify

This commit is contained in:
Will McGugan 2020-12-01 17:03:26 +00:00
parent 9690c1fc05
commit c391684e8f
4 changed files with 18 additions and 1 deletions

View File

@ -25,6 +25,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fixed redirecting of stderr in Progress
- Fixed broken expanded tuple of one https://github.com/willmcgugan/rich/issues/445
- Fixed justify argument not working in console.log https://github.com/willmcgugan/rich/issues/460
## [9.2.0] - 2020-11-08

View File

@ -72,3 +72,11 @@ class LogRender:
output.add_row(*row)
return output
if __name__ == "__main__": # pragma: no cover
from rich.console import Console
c = Console()
c.print("[on blue]Hello", justify="right")
c.log("[on blue]hello", justify="right")

View File

@ -967,7 +967,7 @@ class Console:
def check_text() -> None:
if text:
sep_text = Text(sep, end=end)
sep_text = Text(sep, justify=justify, end=end)
append(sep_text.join(text))
del text[:]

View File

@ -45,6 +45,14 @@ def test_log():
assert rendered == expected
def test_justify():
console = Console(width=20, log_path=False, log_time=False, color_system=None)
console.begin_capture()
console.log("foo", justify="right")
result = console.end_capture()
assert result == " foo\n"
if __name__ == "__main__":
render = render_log()
print(render)