This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author zbysz
Recipients Arfrever, amaury.forgeotdarc, denilsonsa, eric.araujo, giampaolo.rodola, loewis, neologix, pitrou, rosslagerwall, vstinner, zbysz
Date 2012-01-30.17:00:30
SpamBayes Score 3.4521903e-09
Marked as misclassified No
Message-id <>
Here's is an updated version: termsize.diff.6

Following Antoine Pitrou's comment get_terminal_size_raw is renamed back to query_terminal_size.

Tests are moved to, and there's a new test for query_terminal_size -- the output from 'stty size' is parsed. If something fails (e.g. stty is not available), the test is skipped.

I noticed that bash uses $LINES, not $ROWS. I have renamed rows to lines everywhere, to follow existing convention.

The big remaining question seems to be one function vs. two functions.
I'm still convinced that the high-level two function is better. This issue originated in the argparse module, which can use proper terminal size to efficiently format messages. Of course argparse must use a function with a fallback -- if it cannot query, some default must be used. So argparse would implement the high-level function anyway. It might just as well be in os, available for others to be used. Anyway, the second function is 18 lines of python code (excluding docstring and whitespace) -- a bit too much to copy and paste.
Date User Action Args
2012-01-30 17:00:33zbyszsetrecipients: + zbysz, loewis, amaury.forgeotdarc, pitrou, vstinner, giampaolo.rodola, eric.araujo, Arfrever, denilsonsa, neologix, rosslagerwall
2012-01-30 17:00:32zbyszsetmessageid: <>
2012-01-30 17:00:32zbyszlinkissue13609 messages
2012-01-30 17:00:32zbyszcreate