How do I get vi to know my window size?

Rob Landley rob at landley.net
Thu Sep 21 19:56:15 UTC 2006


On Thursday 21 September 2006 5:29 am, Paul Fox wrote:
> i'm a little surprised that rob thinks it should be in the shell. 
> in the absence of LINES and COLUMNS settings, programs that care
> should all be asking the driver.

It actually asks the driver first.  (Well, the tty.)  It resets $LINES and 
$COLUMNS based on what the tty says if it gets a reasonable answer.  If it 
doesn't, it checks $LINES and $COLUMNS, and if that doesn't work either it 
can try the ascii query thing (but only in interactive mode, when stdin and 
stdout point to the same device, and only if there's no input waiting).

> so it doesn't have to be a 
> parent process that determines the size.  in fact, if the parent
> shell sets and exports LINES and COLUMNS, it seems like this will
> only make it harder to deal with window size changes later on.

The terminal wins.

> i'd vote for creating a separate applet (much like x11's resize)
> which can be invoked manually or from .profile or wherever.

If you want to write one I'll review the patch, but I'm not doing it.  (And 
you can already set it in stty anyway.)

I can make the probing a config option if you want, though.  Halfway planning 
on that anyway (want to see how big it is when I'm done, terminal control is 
already a config option in bbsh...)

Rob
-- 
Never bet against the cheap plastic solution.



More information about the busybox mailing list