-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Incorrect auto detection of terminal size on Windows #3412
Labels
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
I don't know why my PR #2916 didn't get any response and was finally closed. Anyway, I'm opening this issue to restate the bug.
Currently, the automatic detection of terminal size on Windows is only performed for
_STDOUT_FILENO
which is the default value passed toos.get_terminal_size
. So if we redirect the standard output (stdout
) to a file and create aConsole
on the standard error (stderr
) withwidth
andheight
leftNone
, the auto-detected terminal size will always be a fallback value(80, 25)
(supposing thatlegacy_windows
isFalse
).A simple example to illustrate this problem: on Windows, run the following test script with
stdout
redirected to a file, whilestderr
was still connected to a terminal, e.g., with width = 140 and height = 21:The output is
which is not the expected:
However, this works as expected On Linux.
Platform
Click to expand
The output of
python -m rich.diagnose
(tested in Rich v13.7.1):The text was updated successfully, but these errors were encountered: