mirror of https://github.com/Textualize/rich.git
fix log jusify
This commit is contained in:
parent
9690c1fc05
commit
c391684e8f
|
@ -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 redirecting of stderr in Progress
|
||||||
- Fixed broken expanded tuple of one https://github.com/willmcgugan/rich/issues/445
|
- 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
|
## [9.2.0] - 2020-11-08
|
||||||
|
|
||||||
|
|
|
@ -72,3 +72,11 @@ class LogRender:
|
||||||
|
|
||||||
output.add_row(*row)
|
output.add_row(*row)
|
||||||
return output
|
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")
|
|
@ -967,7 +967,7 @@ class Console:
|
||||||
|
|
||||||
def check_text() -> None:
|
def check_text() -> None:
|
||||||
if text:
|
if text:
|
||||||
sep_text = Text(sep, end=end)
|
sep_text = Text(sep, justify=justify, end=end)
|
||||||
append(sep_text.join(text))
|
append(sep_text.join(text))
|
||||||
del text[:]
|
del text[:]
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,14 @@ def test_log():
|
||||||
assert rendered == expected
|
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__":
|
if __name__ == "__main__":
|
||||||
render = render_log()
|
render = render_log()
|
||||||
print(render)
|
print(render)
|
||||||
|
|
Loading…
Reference in New Issue