mirror of https://github.com/Textualize/rich.git
sorted
This commit is contained in:
parent
b5f0b743a7
commit
33889ab893
|
@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- Fall back to `sys.__stderr__` on POSIX systems when trying to get the terminal size (fix issues when Rich is piped to another process)
|
||||
- Fixed markup escaping issue https://github.com/Textualize/rich/issues/2187
|
||||
- Safari - Box appearing around SVG export https://github.com/Textualize/rich/pull/2201
|
||||
- Fixed recursion error in Jupyter progress bars https://github.com/Textualize/rich/issues/2047
|
||||
|
||||
## [12.2.0] - 2022-04-05
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import io
|
||||
from typing import List, Any, IO, TYPE_CHECKING
|
||||
from typing import IO, TYPE_CHECKING, Any, List
|
||||
|
||||
from .ansi import AnsiDecoder
|
||||
from .text import Text
|
||||
|
@ -48,7 +48,7 @@ class FileProxy(io.TextIOBase):
|
|||
return len(text)
|
||||
|
||||
def flush(self) -> None:
|
||||
buffer = self.__buffer
|
||||
if buffer:
|
||||
self.__console.print("".join(buffer))
|
||||
del buffer[:]
|
||||
output = "".join(self.__buffer)
|
||||
if output:
|
||||
self.__console.print(output)
|
||||
del self.__buffer[:]
|
||||
|
|
|
@ -25,3 +25,14 @@ def test_flush():
|
|||
assert file.getvalue() == ""
|
||||
file_proxy.flush()
|
||||
assert file.getvalue() == "foo\n"
|
||||
|
||||
|
||||
def test_new_lines():
|
||||
|
||||
file = io.StringIO()
|
||||
console = Console(file=file)
|
||||
file_proxy = FileProxy(console, file)
|
||||
file_proxy.write("-\n-")
|
||||
assert file.getvalue() == "-\n"
|
||||
file_proxy.flush()
|
||||
assert file.getvalue() == "-\n-\n"
|
||||
|
|
Loading…
Reference in New Issue