winheight (was RE: Tabs revisited)
- Ok, I know what's going on now.
If the options are in _vimrc, then they are in effect by the time the first
to make_windows() happens. The result is that the computed "maxcount"
out negative (since there's no room for even one 999-height window) and the
that to 2:
if (maxcount < 2)
maxcount = 2;
If the options are set on the command-line or via VimEnter, then in
is a large number (since the settings haven't taken effect yet.) So all the
windows get created, and then on processing the :set commands the layout
falls into place.
The key is the computation of "maxcount"
/* Each window needs at least 'winminheight' lines and a status line. */
maxcount = (curwin->w_height + curwin->w_status_height
- (p_wh - p_wmh)) / (p_wmh + STATUS_HEIGHT);
At startup, (curwin->w_height + curwin->w_status_height) is effectively
the number of screen lines. From this is subtracted (winheight -
the idea being that the resulting maxcount is the number of windows
possible such that one has "winheight" and the others "winminheight".
That works fine as long as "winheight" is a "genuine" value, i.e.
setting it to 25 in a 50-line display. But it breaks down when you
use a huge value for "winheight" to mean "as big as Vim can manage."
The same sort of thing explains the behavour of ":all". It calls
win_split_ins with the WSP_ROOM flag, resulting in the same
(winheight - winminheight) term being applied:
if (flags & WSP_ROOM)
needed += p_wh - p_wmh;
Although this came to light via the use of -o, it's the :all
behaviour that is the more significant. In essence, "winheight" is
fibbing slightly when it says (in the help)
" Minimal number of lines for the current window. This is not a hard
minimum, Vim will use fewer lines if there is not enough room."
because in some circumstances it *is* treated as a hard limit (e.g.
the processing of the ":all" command.)
Removing the use of the (p_wh - p_wmh) expression in the two
places mentioned removes this hard limit behaviour, but maybe it
has some side effects...?
> -----Original Message-----Legal Disclaimer: Any views expressed by the sender of this message are
> From: Antony Scriven [SMTP:ads@...]
> Sent: Tuesday, June 01, 2004 2:22 PM
> To: vim-dev@...
> Subject: Re: Tabs revisited
> Vince Negri wrote:
> > There is something strange happening.
> > if I do Benji's
> > vim -N -u NONE +"set wh=999 wmh=0 ls=2" -o file1 file2 file3
> > Then I get three status lines for the three files.
> > *but* if I create a _vimrc which has only the line
> > set wh=999 wmh=0 ls=2
> > in it, and then do
> > vim -N -u _vimrc -o file1 file2 file3
> > I only get status lines for file1 and file2.
> > Surely those two commands ought to be equivalent?
> Maybe it's something to do with there not being a terminal
> present when the _vimrc is executed?
> au vimenter * set wh=999 wmh=0 ls=2
> works fine.
not necessarily those of Application Solutions Ltd. Information in this
e-mail may be confidential and is for the use of the intended recipient
only, no mistake in transmission is intended to waive or compromise such
privilege. Please advise the sender if you receive this e-mail by mistake.