in reply to Re: bulletproof way of finding size of terminal?
in thread bulletproof way of finding size of terminal?
Here's a litle sub I wrote a while back. For once, I kept some decent comments on where I found it to work, and not work.
# $ENV{COLUMNS} isn't set when running through putty (unless from with +in emacs) # GetTerminalSize returns 0 from emacs, but ok from putty # fallback to 72 if the other two methods fail sub get_terminal_width { -t STDOUT && return (GetTerminalSize)[0] || $ENV{COLUMNS} || 72; return 72; }
The FAQ postings are the only thing I miss from clpmisc
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: bulletproof way of finding size of terminal?
by bcrowell2 (Friar) on Aug 31, 2007 at 22:25 UTC | |
by FunkyMonk (Bishop) on Aug 31, 2007 at 22:49 UTC |