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.23:25:44
SpamBayes Score 5.5113913e-11
Marked as misclassified No
Message-id <>
Updated version following comments by Victor Stinner: termsize.diff.7

- os.get_terminal_size() is moved to shutil.get_terminal_size()
- some small doc updates

Victor STINNER wrote:
>> I noticed that bash uses $LINES, not $ROWS. I have renamed rows to
>> lines everywhere, to follow existing convention.
> The stty program has "rows" and "columns" commands to set the terminal
Yes, also struct winsize uses 'rows' and 'cols'. But since we use the variable $LINES, it seems better to use 'lines'.

Thanks for the link to SUSv2! I've added a link in the docs, since it adds a nice justification to the COLUMNS/query/fallback behaviour.

Now get_terminal_size() lives in shutil. I don't think it matters much, but I see the point of keeping os clean.

I also looked at some programs, to see who behaves how.
dpkg -> COLUMNS first
aptitude -> ignores COLUMNS
git -> COLUMNS first
systemctl, loginctl, systemd-cgls (systemd cmdline interface) -> COLUMNS first
less, w ->  ioctl, COLUMNS as fallback

(Of course this is very unscientific, because I just picked some programs at random which I remembered to care about the terminal size).
I guess that the case of 'less' is special, because less is very
much dependent on the terminal and does quite a lot of manipulations on it. Otherwise, taking COLUMNS as highest priority seems well established, even if not universal.
Date User Action Args
2012-01-30 23:25:46zbyszsetrecipients: + zbysz, loewis, amaury.forgeotdarc, pitrou, vstinner, giampaolo.rodola, eric.araujo, Arfrever, denilsonsa, neologix, rosslagerwall
2012-01-30 23:25:45zbyszsetmessageid: <>
2012-01-30 23:25:44zbyszlinkissue13609 messages
2012-01-30 23:25:44zbyszcreate