Bjorn wrote:
> I've stumbled across something in main.c/ui.c that looks a bit fishy
> whilst trying to figure out how and when the variables "Rows" and
> "Columns" are initialized.
>
> In "main()", "ui_get_shellsize()" is called to "Set the default values
> for the options that use Rows and Columns". This function checks
> "gui.in_use" to determine whether to call "gui_get_shellsize()" or
> "mch_set_shellsize()". However, at this point "gui.in_use" has not
> been initialized and will always be "FALSE" (it is initialized later
> in "main()" when "gui_init()" is called) so if the GUI is starting the
> incorrect function is called.
>
> It seems other GUIs are working around this bug(?) with #ifdef's here
> and there to initialize "Rows" and "Columns", but wouldn't it be
> better to solve this by changing "ui_get_shellsize()" to check for
> "gui.in_use || gui.starting" instead? Something like:
>
> int
> ui_get_shellsize()
> {
> int retval;
>
> #ifdef FEAT_GUI
> if (gui.in_use || gui.starting)
> retval = gui_get_shellsize();
> else
> #endif
> retval = mch_get_shellsize();
>
> This problem does not seem to affect the other functions in ui.c that
> check "gui.in_use" since they are not call this early in the
> initialization (as far as I can tell). This change may affect the
> initializations of the other GUIs, hence this post is formulated as a
> questions instead of me posting a patch.
This logic is based on the Unix situation: One starts gvim from a
terminal and the GUI window will get the size of the terminal.
This part of main() is done before opening the GUI window, thus getting
its size is not possible anyway.
If a window size was specified at startup, e.g., on the command line or
in the .vimrc, that should be used instead of the terminal size. This
logic is a bit fishy, e.g., to do a pass over the command line arguments
very early and making sure the values are not changed somewhere else.
--
Scientists decoded the first message from an alien civilization:
SIMPLY SEND 6 TIMES 10 TO THE 50 ATOMS OF HYDROGEN TO THE STAR
SYSTEM AT THE TOP OF THE LIST, CROSS OFF THAT STAR SYSTEM, THEN PUT
YOUR STAR SYSTEM AT THE BOTTOM OF THE LIST AND SEND IT TO 100 OTHER
STAR SYSTEMS. WITHIN ONE TENTH GALACTIC ROTATION YOU WILL RECEIVE
ENOUGH HYDROGREN TO POWER YOUR CIVILIZATION UNTIL ENTROPY REACHES ITS
MAXIMUM! IT REALLY WORKS!
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ download, build and distribute -- http://www.A-A-P.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---