Open
Conversation
0f81cd1 (Remove eyed3.utils.console.getTtySize() implementation (nicfit#682), 2025-10-22) didn't take into account the difference in the order of the tuple contents. As a result, it now returns the terminal height when it intends to return the width. To demonstrate: $ python -c 'print(); import shutil; from eyed3.utils.console import getTtySize; print(shutil.get_terminal_size()); print(tuple(shutil.get_terminal_size())); print(getTtySize()) ' os.terminal_size(columns=80, lines=24) (80, 24) (24, 80) Fortunately, the output from shutil.get_terminal_size() is a named tuple. Use the `os.terminal_size` field names rather than slicing to get the terminal width in several locations. This makes the code clearer and less likely to accidentally transpose the height and width. Fixes nicfit#689
Contributor
Author
|
Before: After: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
0f81cd1 (Remove eyed3.utils.console.getTtySize() implementation (#682), 2025-10-22) didn't take into account the difference in the order of the tuple contents. As a result, it now returns the terminal height when it intends to return the width.
To demonstrate:
Fortunately, the output from shutil.get_terminal_size() is a named tuple. Use the
os.terminal_sizefield names rather than slicing to get the terminal width in several locations. This makes the code clearer and less likely to accidentally transpose the height and width.Fixes #689