Why does the command window grow and ignore cmdwinheight?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Why does the command window grow and ignore cmdwinheight?

Eric Arnold
Normally, everything works fine, sometimes it gets into some bad place.

Scenario: I've got two windows, one the default nofile, and the other is
the one running my script.  When my window exists, it can leave the
command window resized waay up (probably by the size of window that closed).

After my window is gone, the default nofile window has "winheight=1",
though it is clearly 20 lines or so, and  "cmdheight=4" although it is
clearly about 20 lines or so also.  

If I   :set winheight=99   and   :set cmdheight=4   the default window
does nothing and the command window resizes itself down one line to
about 19 lines or so.  No matter what I do with the window(s), I can
no longer change the command window height except by dragging it with
the mouse.

So, both windows seem to have their height mechanisms broken.  It is
probably broken by something in my enter/exit autocommands, which try to
restore everything with the   winrestcmd()  function, which returns a
seemingly harmless command string like:

        1resize 18|vert 1resize 80|2resize 18|vert 2resize 80|

So, the question is, What could I possibly be doing that would *sometimes*
break all the window resizing functionality?

One related question is how is the magic default "winheight=1" managed
to resize nicely when windows open or close around it.


Reply | Threaded
Open this post in threaded view
|

Re: Why does the command window grow and ignore cmdwinheight?

A.J.Mechelynck
Eric Arnold wrote:
> Normally, everything works fine, sometimes it gets into some bad place.
>
> Scenario: I've got two windows, one the default nofile, and the other is
> the one running my script.  When my window exists, it can leave the
> command window resized waay up (probably by the size of window that closed).

strange
>
> After my window is gone, the default nofile window has "winheight=1",
> though it is clearly 20 lines or so,

this is normal: winheight is a "desired minimum".

> and  "cmdheight=4" although it is
> clearly about 20 lines or so also.  

that surprises me

>
> If I   :set winheight=99   and   :set cmdheight=4   the default window
> does nothing and the command window resizes itself down one line to
> about 19 lines or so.  No matter what I do with the window(s), I can
> no longer change the command window height except by dragging it with
> the mouse.
>
> So, both windows seem to have their height mechanisms broken.  It is
> probably broken by something in my enter/exit autocommands, which try to
> restore everything with the   winrestcmd()  function, which returns a
> seemingly harmless command string like:
>
> 1resize 18|vert 1resize 80|2resize 18|vert 2resize 80|
>
> So, the question is, What could I possibly be doing that would *sometimes*
> break all the window resizing functionality?
>
> One related question is how is the magic default "winheight=1" managed
> to resize nicely when windows open or close around it.

'winheight' is a "desired minimum" for the current window: the window
will get that many lines or more, unless there is no room. For instance
":set winheight=99999" makes the current window as high as possible.

'winminheight' is an "absolute minimum" for all windows: each window
will get at least that many lines. Creating a new window will (IIUC)
fail if it would require reducing one or more windows to less than that.
With ":set winminheight=0" it is possible to squish non-current windows
to a status line and nothing else. (The active window will always have
at least one line, in order to display the cursor.)

When 'laststatus' is 0 (zero), the bottom window will not have a status
line. You might then confuse it with the command-line. Also if there is
only one window and 'laststatus' is 1 (one).

IIUC, 'cmdheight' is the exact number of lines of the command-line area.
If there are too many messages it will temporarily expand, but hitting
Enter or Space will resize it down. (But see 'laststatus' above).

See also
        :help 'equalalways'
        :help CTRL-W__
        :help CTRL-W_=
etc.

Note: If there is only one window, resizing it changes the size of the
command-line area.


Best regards,
Tony.