Message152360
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:46 | zbysz | set | recipients:
+ zbysz, loewis, amaury.forgeotdarc, pitrou, vstinner, giampaolo.rodola, eric.araujo, Arfrever, denilsonsa, neologix, rosslagerwall |
2012-01-30 23:25:45 | zbysz | set | messageid: <1327965945.56.0.885419783195.issue13609@psf.upfronthosting.co.za> |
2012-01-30 23:25:44 | zbysz | link | issue13609 messages |
2012-01-30 23:25:44 | zbysz | create | |
|