atom feed24 messages in org.python.python-listHow to get terminal width?
FromSent OnAttachments
Craig P McDanielMay 2, 2000 4:44 pm 
Doug StanfieldMay 3, 2000 1:41 am 
Donn CaveMay 3, 2000 9:46 am 
Martin P HollandMay 3, 2000 12:04 pm 
Doug StanfieldMay 3, 2000 12:06 pm 
Samuel A. Falvo IIMay 3, 2000 1:00 pm 
Justin SheehyMay 3, 2000 2:37 pm 
Doug StanfieldMay 3, 2000 3:07 pm 
Justin SheehyMay 3, 2000 4:47 pm 
Donn CaveMay 3, 2000 5:32 pm 
Juergen A. ErhardMay 3, 2000 7:51 pm 
Quinn DunkanMay 3, 2000 10:02 pm 
Donn CaveMay 4, 2000 9:28 am 
Greg EwingMay 4, 2000 7:20 pm 
Jeff BauerMay 4, 2000 7:40 pm 
Paul JacksonMay 4, 2000 7:57 pm 
Mark JacksonMay 4, 2000 8:00 pm 
David ArnoldMay 4, 2000 8:09 pm 
Bjorn PettersenMay 4, 2000 8:42 pm 
Donn CaveMay 5, 2000 9:44 am 
Bjorn PettersenMay 5, 2000 11:22 am 
Radovan GarabikMay 5, 2000 1:46 pm 
Donn CaveMay 5, 2000 2:50 pm 
Paul JacksonMay 5, 2000 3:17 pm 
Subject:How to get terminal width?
From:Donn Cave (do@u.washington.edu)
Date:May 5, 2000 9:44:43 am
List:org.python.python-list

Quoth Bjorn Pettersen <bjorn at roguewave.com>: | Paul Jackson wrote: | > | > "stty size" isn't defined on my Irix box, but: | > | > tput cols | > | > works on each of my Irix, SuSE and TurboLinux boxes, | > issuing simply the number of columns. | | Well, we're getting closer :-) | | The above doesn't work on: | | SunOS 4.1.4 (not present) | SunOS 5.4 (wrong result) | | But does work on: | | RedHat 6.0 | Solaris 2.6, 2.7 (7), 8 | HPUX 10.20, 11 | AIX 4.2, 4.3 | IRIX64 6.2, 6.5 | Dec 3.2

And it works on FreeBSD 4.0, and BeOS 4.5 and 5.0

However - "tput" is really mainly about terminal-specific information retrieved from termcap/terminfo, and that shows in a couple of ways. On BeOS, and I bet a few other platforms, I get "80" regardless of my actual window size. It can get the information from the terminal description, and that's probably legitimate if not ideal. Tput also fails when the terminal type is unknown (a marginal problem, but could be worse than you might think, if the platform suffers from the all too common terminfo vs. termcap split.) All this goes back to the dark ages when we had real terminals, with more or less fixed screen sizes.