Fixed item from todo list:

> Win32: When 'shell' is cmd.exe this command fails:
>       echo system('"c:/path/echo.exe" "foo bar"')
> Should we set the default for 'shellxquote' to a double quote, when 'shell'
> contains "cmd" in the tail?  (Benjamin Fritz, 2008 Oct 13)
> Also set 'shellcmdflag' to include /s.

While making my changes, I noticed the following strange behavior.

If a user's .vimrc sets the value of 'shellxquote' or 'shellcmdflag',
then the default value is not updated by the code I touched, because
of the checks for the P_WAS_SET flag.

But this means, if the user has this in their .vimrc on Windows:

set shell=sh
set shellxquote=\"
set shellcmdflag=-c

Then a later command of :set shell& shellxquote& shellcmdflag& will
set the values to "cmd.exe", "", and "/c" respectively. But if in
their .vimrc they only have:

set shell=sh

then Vim automatically sets shellxquote and shellcmdflag to "\"" and
"-c", respectively.

However, if the user later does :set shell& shellxquote&
shellcmdflag&, they get "cmd.exe", "\"", and "-c".

More to the point for this patch, if the user has in their .vimrc on
Windows, because they were enlightened back in 2008, 'set
shellxquote=\" shellcmdflag=/s /c', then after this patch this is
unnecessary, but if they try to set these values to their defaults,
they will get the *old* defaults.

What is the reason for only updating the default value of options, if
P_WAS_SET is false? I get that we don't want to override the actual
value of the option if the user set it to something, but don't we want
to update the default value? E.g. shouldn't we do something like this,
throughout option.c?

        int     idx3;

        idx3 = findoption((char_u *)"shcf");
-       if (idx3 >= 0 && !(options[idx3].flags & P_WAS_SET))
-       {
-           p_shcf = (char_u *)"-c";
-           options[idx3].def_val[VI_DEFAULT] = p_shcf;
+       if (idx3 >= 0)
+       {
+           options[idx3].def_val[VI_DEFAULT] = (char_u *)"-c";
+           if (!(options[idx3].flags & P_WAS_SET))
+           {
+               p_shcf = options[idx3].def_val[VI_DEFAULT];
+           }
        }

-- 
Ben

-- 
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