Improved routine for terminal dimensions. Works on windows too. - #127
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
| except (ImportError, ModuleNotFoundError): | ||
| pass | ||
|
|
||
| __version__ = '0.1.1' |
There was a problem hiding this comment.
Removed as this was a legacy of terminal.py being its own package.
| # Mutually exclusive to the paging of text and overrides that behaviour. | ||
| if opt in ('-s', '--size'): | ||
| print('Length: %d, Width: %d' % TerminalSize()) | ||
| print('Width: %d, Length: %d' % TerminalSize()) |
There was a problem hiding this comment.
This is the only user facing change.
|
Slight change in behaviour, unlikely to be observed by users except for a corner case where environment vars are different (for some reason?) from the terminal size itself. From https://github.com/python/cpython/blob/main/Lib/shutil.py#L1438 we see that the standard function uses the environment vars in preference to interrogating the terminal itself. The code being replaced here would only fell back to using the environment vars if the call to the terminal failed. The new behaviour is probably preferable. |
…le#127) * Improved routine for terminal dimensions. Works on windows too. * Improve clarity or variable names * Remove TerminalSize function .... no longer needed
No description provided.