From 7af96dcaf86025f7a5332ff8945e5cbd572efe09 Mon Sep 17 00:00:00 2001 From: Will McGugan Date: Sat, 6 Jun 2020 13:25:21 +0100 Subject: [PATCH] no need to add justify --- CHANGELOG.md | 2 ++ docs/source/console.rst | 4 ++-- rich/console.py | 5 ++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e8b8cc98..dd7cf1ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/docs/source/console.rst b/docs/source/console.rst index 2353b1da..6c34b171 100644 --- a/docs/source/console.rst +++ b/docs/source/console.rst @@ -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 diff --git a/rich/console.py b/rich/console.py index 2ef2f80f..2f7af486 100644 --- a/rich/console.py +++ b/rich/console.py @@ -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``.