no need to add justify

This commit is contained in:
Will McGugan 2020-06-06 13:25:21 +01:00
parent 8ad293cf5f
commit 7af96dcaf8
3 changed files with 6 additions and 5 deletions

View File

@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added overflow methods
- Added no_wrap option to print()
- Added width option to print
### Fixed
@ -19,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- Renamed \_ratio.ratio_divide to \_ratio.ratio_distribute
- Renamed JustifyValues to JustifyMethod
## [1.3.1] - 2020-06-01

View File

@ -91,9 +91,9 @@ To help with debugging, the log() method has a ``log_locals`` parameter. If you
Justify / Alignment
-------------------
Both print and log support a ``justify`` argument which if set must be one of "left", "right", "center", or "full". If "left", any text printed (or logged) will be left aligned, if "right" text will be aligned to the right of the terminal, if "center" the text will be centered, and if "full" the text will be lined up with both the left and right edges of the terminal (like printed text in a book).
Both print and log support a ``justify`` argument which if set must be one of "default", "left", "right", "center", or "full". If "left", any text printed (or logged) will be left aligned, if "right" text will be aligned to the right of the terminal, if "center" the text will be centered, and if "full" the text will be lined up with both the left and right edges of the terminal (like printed text in a book).
The default for ``justify`` is ``None`` which will generally look the same as ``"left"`` but with a subtle difference. Left justify will pad the right of the text with spaces, while a None justify will not. You will only notice the difference if you set a background color with the ``style`` argument. The following example demonstrates the difference::
The default for ``justify`` is ``"default"`` which will generally look the same as ``"left"`` but with a subtle difference. Left justify will pad the right of the text with spaces, while a default justify will not. You will only notice the difference if you set a background color with the ``style`` argument. The following example demonstrates the difference::
from rich.console import Console

View File

@ -672,7 +672,7 @@ class Console:
def check_text() -> None:
if text:
sep_text = Text(sep, justify=text[0].justify or justify, end=end)
sep_text = Text(sep, end=end)
append(sep_text.join(text))
del text[:]
@ -684,7 +684,6 @@ class Console:
append_text(
self.render_str(
renderable,
justify=justify,
emoji=emoji,
markup=markup,
highlighter=_highlighter,
@ -750,7 +749,7 @@ class Console:
sep (str, optional): String to write between print data. Defaults to " ".
end (str, optional): String to write at end of print data. Defaults to "\n".
style (Union[str, Style], optional): A style to apply to output. Defaults to None.
justify (str, optional): Overflowmethod: "left", "right", "center", or "full". Defaults to ``None``.
justify (str, optional): Justify method: "left", "right", "center", or "full". Defaults to ``None``.
overflow (str, optional): Overflow method: "crop", "fold", or "ellipisis". Defaults to None.
no_wrap (Optional[bool], optional): Disable wrapping. Defaults to None
emoji (Optional[bool], optional): Enable emoji code, or ``None`` to use console default. Defaults to ``None``.