This commit is contained in:
Will McGugan 2024-10-01 12:38:31 +01:00
parent 3936debf0c
commit fd7b32603c
2 changed files with 4 additions and 2 deletions

View File

@ -1005,7 +1005,8 @@ class Console:
width: Optional[int] = None
height: Optional[int] = None
for file_descriptor in _STD_STREAMS_OUTPUT if WINDOWS else _STD_STREAMS:
streams = _STD_STREAMS_OUTPUT if WINDOWS else _STD_STREAMS
for file_descriptor in streams:
try:
width, height = os.get_terminal_size(file_descriptor)
except (AttributeError, ValueError, OSError): # Probably not a terminal

View File

@ -111,6 +111,7 @@ def test_title_text() -> None:
console = Console(
file=io.StringIO(),
width=50,
height=20,
legacy_windows=False,
force_terminal=True,
color_system="truecolor",
@ -119,7 +120,7 @@ def test_title_text() -> None:
result = console.file.getvalue()
print(repr(result))
expected = "╭───────────────────────────────────\x1b[31m title \x1b[0m────────────────────────────────────\n│ Hello, World \n──────────────────────────────────\x1b[1;35m subtitle \x1b[0m──────────────────────────────────╯\n"
expected = "╭────────────────────\x1b[31m title \x1b[0m─────────────────────╮\n│ Hello, World\n───────────────────\x1b[1;35m subtitle \x1b[0m───────────────────╯\n"
assert result == expected