resolved RESOLVED UNSUBMITTED PASS · None tool calls · 0 s · Textualize/rich
empty with end - Fixes https://github.com/Textualize/rich/issues/3740 - Drop support for Python 3.8
| # | Tool | Arguments | Result |
|---|---|---|---|
| No trace captured. | |||
--- a/rich/console.py
+++ b/rich/console.py
@@ -7,6 +7,7 @@
from functools import wraps
from itertools import islice
from math import ceil
+from os import PathLike
from time import monotonic
from types import FrameType, ModuleType, TracebackType
from typing import (
@@ -29,7 +30,6 @@
cast,
runtime_checkable,
)
-from os import PathLike
from rich._null_file import NULL_FILE
@@ -1687,7 +1687,10 @@ def print(
new_line_start (bool, False): Insert a new line at the start if the output contains more than one line. Defaults to ``False``.
"""
if not objects:
- objects = (NewLine(),)
+ if end == "\n":
+ objects = (NewLine(),)
+ else:
+ objects = ("",)
if soft_wrap is None:
soft_wrap = self.soft_wrap
@@ -2218,7 +2221,13 @@ def export_text(self, *, clear: bool = True, styles: bool = False) -> str:
del self._record_buffer[:]
return text
- def save_text(self, path: Union[str, PathLike[str]], *, clear: bool = True, styles: bool = False) -> None:
+ def save_text(
+ self,
+ path: Union[str, PathLike[str]],
+ *,
+ clear: bool = True,
+ styles: bool = False,
+ ) -> None:
"""Generate text from console and save to a given location (requires record=True argument in constructor).
Args:........................................................................ [ 72%] ............................ [100%] 100 passed in 0.70s