Hello All,

I am trying to configure gvim in a portable manner to use the maximum number of lines that will fit on the screen. After a bit of searching, I found this under the help for 'lines':

    When Vim is running in the GUI or in a resizable window, setting
    this option will cause the window size to be changed.  When you only
    want to use the size for the GUI, put the command in your |gvimrc|
    file.  Vim limits the number of lines to what fits on the screen.
    You can use this command to get the tallest window possible:
        :set lines=999

When I am running under Windows, this works great. However, when running under Linux, it doesn't limit the window to the size of the screen - I get a really tall window that extends well below the bottom of the screen.

The relevant code is in gui_set_shellsize - the stack trace on Linux looks like this:

#0  gui_set_shellsize (mustset=1, fit_to_display=0, direction=15) at
    gui.c:1548
#1  0x00000000005b9829 in ui_set_shellsize (mustset=1) at ui.c:329
#2  0x00000000005b5218 in set_shellsize (width=80, height=999,
    mustset=1) at term.c:3057
#3  0x0000000000537977 in set_num_option (opt_idx=169,
    varp=0x871160 "\347\003", value=999, errbuf=0x7fffffffd3c0 "",
    errbuflen=80, opt_flags=0) at option.c:8491


Note that the second parameter to gui_set_shellsize, fit_to_display, is 0. This is because ui_set_shellsize, when calling gui_set_shellsize, always passes FALSE for the fit_to_display parameter on all non-Microsoft Windows platforms (it always passes TRUE under Windows). I wondered why this was so, so I dug through the version control history, but it appears that this behavior has been present since the first checkin to CVS.

So, except on Windows, the documentation does not match the actual behavior. This leads to my first question - is there a reason for this? I have patched my build of gvim so that gui_set_shellsize forces fit_to_display to be TRUE no matter what was passed in, and I get the documented behavior. So, on Linux at least, there does not appear to be a technical reason why gvim cannot behave as documented.

I am happy to make an attempt at a patch, but I need direction as to which avenue to pursue:

A) update the documentation to note the difference between platforms, make no changes to the code, and continue patching my local copy of gvim.

B) change ui_set_shellsize to always pass TRUE for the fit_to_display parameter of gui_set_shellsize, no matter the platform. Would this break existing scripts/configurations? Is there a use case for not wanting to limit the window size to fit on the screen when setting lines (or columns)?

C) add a new boolean option which controls whether or not the window size is limited to the size of the screen, defaulting to true on Windows on false on all other platforms.

D) another approach I haven't thought of yet

Feedback is appreciated.

Cheers,

Daniel Harding

--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Raspunde prin e-mail lui