Merge pull request #7313 from ckelsel/vim-8.0.0101

vim-patch:8.0.0101,8.0.0102,8.0.0104,8.0.0106
This commit is contained in:
James McCoy 2017-10-17 12:48:48 -04:00 committed by GitHub
commit 0f0fcce1ab
5 changed files with 48 additions and 16 deletions

View File

@ -74,6 +74,7 @@ local get_flags = function(o)
{'gettext'},
{'noglob'},
{'normal_fname_chars', 'P_NFNAME'},
{'normal_dname_chars', 'P_NDNAME'},
{'pri_mkrc'},
{'deny_in_modelines', 'P_NO_ML'},
{'deny_duplicates', 'P_NODUP'},

View File

@ -242,6 +242,7 @@ typedef struct vimoption {
#define P_NO_DEF_EXP 0x8000000U ///< Do not expand default value.
#define P_RWINONLY 0x10000000U ///< only redraw current window
#define P_NDNAME 0x20000000U ///< only normal dir name chars allowed
#define HIGHLIGHT_INIT \
"8:SpecialKey,~:EndOfBuffer,z:TermCursor,Z:TermCursorNC,@:NonText," \
@ -2454,11 +2455,14 @@ did_set_string_option (
if ((secure || sandbox != 0)
&& (options[opt_idx].flags & P_SECURE)) {
errmsg = e_secure;
} else if ((options[opt_idx].flags & P_NFNAME)
&& vim_strpbrk(*varp, (char_u *)"/\\*?[|;&<>\r\n") != NULL) {
// Check for a "normal" file name in some options. Disallow a path
// separator (slash and/or backslash), wildcards and characters that are
// often illegal in a file name.
} else if (((options[opt_idx].flags & P_NFNAME)
&& vim_strpbrk(*varp, (char_u *)(secure ? "/\\*?[|;&<>\r\n"
: "/\\*?[<>\r\n")) != NULL)
|| ((options[opt_idx].flags & P_NDNAME)
&& vim_strpbrk(*varp, (char_u *)"*?[|;&<>\r\n") != NULL)) {
// Check for a "normal" directory or file name in some options. Disallow a
// path separator (slash and/or backslash), wildcards and characters that
// are often illegal in a file name. Be more permissive if "secure" is off.
errmsg = e_invarg;
}
/* 'backupcopy' */
@ -3173,17 +3177,18 @@ did_set_string_option (
} else {
// Options that are a list of flags.
p = NULL;
if (varp == &p_ww)
if (varp == &p_ww) { // 'whichwrap'
p = (char_u *)WW_ALL;
if (varp == &p_shm)
}
if (varp == &p_shm) { // 'shortmess'
p = (char_u *)SHM_ALL;
else if (varp == &(p_cpo))
} else if (varp == &(p_cpo)) { // 'cpoptions'
p = (char_u *)CPO_VI;
else if (varp == &(curbuf->b_p_fo))
} else if (varp == &(curbuf->b_p_fo)) { // 'formatoptions'
p = (char_u *)FO_ALL;
else if (varp == &curwin->w_p_cocu)
} else if (varp == &curwin->w_p_cocu) { // 'concealcursor'
p = (char_u *)COCU_ALL;
else if (varp == &p_mouse) {
} else if (varp == &p_mouse) { // 'mouse'
p = (char_u *)MOUSE_ALL;
}
if (p != NULL) {

View File

@ -7,7 +7,7 @@
-- enable_if=nil,
-- defaults={condition=nil, if_true={vi=224, vim=0}, if_false=nil},
-- secure=nil, gettext=nil, noglob=nil, normal_fname_chars=nil,
-- pri_mkrc=nil, deny_in_modelines=nil,
-- pri_mkrc=nil, deny_in_modelines=nil, normal_dname_chars=nil,
-- expand=nil, nodefault=nil, no_mkrc=nil, vi_def=true, vim=true,
-- alloced=nil,
-- save_pv_indir=nil,
@ -575,6 +575,7 @@ return {
full_name='dictionary', abbreviation='dict',
type='string', list='onecomma', scope={'global', 'buffer'},
deny_duplicates=true,
normal_dname_chars=true,
vi_def=true,
expand=true,
varname='p_dict',
@ -1750,6 +1751,7 @@ return {
{
full_name='printexpr', abbreviation='pexpr',
type='string', scope={'global'},
secure=true,
vi_def=true,
varname='p_pexpr',
defaults={if_true={vi=""}}
@ -2449,6 +2451,7 @@ return {
full_name='thesaurus', abbreviation='tsr',
type='string', list='onecomma', scope={'global', 'buffer'},
deny_duplicates=true,
normal_dname_chars=true,
vi_def=true,
expand=true,
varname='p_tsr',

View File

@ -104,6 +104,29 @@ func Test_keymap_valid()
call assert_fails(":set kmp=trunc\x00name", "trunc")
endfunc
func Check_dir_option(name)
" Check that it's possible to set the option.
exe 'set ' . a:name . '=/usr/share/dict/words'
call assert_equal('/usr/share/dict/words', eval('&' . a:name))
exe 'set ' . a:name . '=/usr/share/dict/words,/and/there'
call assert_equal('/usr/share/dict/words,/and/there', eval('&' . a:name))
exe 'set ' . a:name . '=/usr/share/dict\ words'
call assert_equal('/usr/share/dict words', eval('&' . a:name))
" Check rejecting weird characters.
call assert_fails("set " . a:name . "=/not&there", "E474:")
call assert_fails("set " . a:name . "=/not>there", "E474:")
call assert_fails("set " . a:name . "=/not.*there", "E474:")
endfunc
func Test_dictionary()
call Check_dir_option('dictionary')
endfunc
func Test_thesaurus()
call Check_dir_option('thesaurus')
endfunc
func Test_complete()
" Trailing single backslash used to cause invalid memory access.
set complete=s\

View File

@ -997,12 +997,12 @@ static const int included_patches[] = {
// 109 NA
// 108 NA
// 107 NA
// 106,
106,
// 105 NA
// 104,
104,
// 103 NA
// 102,
// 101,
102,
101,
100,
99,
// 98 NA