mirror of
https://github.com/neovim/neovim.git
synced 2025-09-27 13:38:34 +00:00
vim-patch:8.0.0102
Problem: Cannot set 'dictionary' to a path.
Solution: Allow for slash and backslash. Add a test (partly by Daisuke
Suzuki, closes vim/vim#1279, closes vim/vim#1284)
7554da4033
This commit is contained in:
@@ -74,6 +74,7 @@ local get_flags = function(o)
|
|||||||
{'gettext'},
|
{'gettext'},
|
||||||
{'noglob'},
|
{'noglob'},
|
||||||
{'normal_fname_chars', 'P_NFNAME'},
|
{'normal_fname_chars', 'P_NFNAME'},
|
||||||
|
{'normal_dname_chars', 'P_NDNAME'},
|
||||||
{'pri_mkrc'},
|
{'pri_mkrc'},
|
||||||
{'deny_in_modelines', 'P_NO_ML'},
|
{'deny_in_modelines', 'P_NO_ML'},
|
||||||
{'deny_duplicates', 'P_NODUP'},
|
{'deny_duplicates', 'P_NODUP'},
|
||||||
|
@@ -242,6 +242,7 @@ typedef struct vimoption {
|
|||||||
#define P_NO_DEF_EXP 0x8000000U ///< Do not expand default value.
|
#define P_NO_DEF_EXP 0x8000000U ///< Do not expand default value.
|
||||||
|
|
||||||
#define P_RWINONLY 0x10000000U ///< only redraw current window
|
#define P_RWINONLY 0x10000000U ///< only redraw current window
|
||||||
|
#define P_NDNAME 0x20000000U ///< only normal dir name chars allowed
|
||||||
|
|
||||||
#define HIGHLIGHT_INIT \
|
#define HIGHLIGHT_INIT \
|
||||||
"8:SpecialKey,~:EndOfBuffer,z:TermCursor,Z:TermCursorNC,@:NonText," \
|
"8:SpecialKey,~:EndOfBuffer,z:TermCursor,Z:TermCursorNC,@:NonText," \
|
||||||
@@ -2454,11 +2455,13 @@ did_set_string_option (
|
|||||||
if ((secure || sandbox != 0)
|
if ((secure || sandbox != 0)
|
||||||
&& (options[opt_idx].flags & P_SECURE)) {
|
&& (options[opt_idx].flags & P_SECURE)) {
|
||||||
errmsg = e_secure;
|
errmsg = e_secure;
|
||||||
} else if ((options[opt_idx].flags & P_NFNAME)
|
} else if ((((options[opt_idx].flags & P_NFNAME)
|
||||||
&& vim_strpbrk(*varp, (char_u *)"/\\*?[|;&<>\r\n") != NULL) {
|
&& vim_strpbrk(*varp, (char_u *)"/\\*?[|;&<>\r\n") != NULL))
|
||||||
// Check for a "normal" file name in some options. Disallow a path
|
|| ((options[opt_idx].flags & P_NDNAME)
|
||||||
// separator (slash and/or backslash), wildcards and characters that are
|
&& vim_strpbrk(*varp, (char_u *)"*?[|;&<>\r\n") != NULL)) {
|
||||||
// often illegal in a file name.
|
// 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.
|
||||||
errmsg = e_invarg;
|
errmsg = e_invarg;
|
||||||
}
|
}
|
||||||
/* 'backupcopy' */
|
/* 'backupcopy' */
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
-- enable_if=nil,
|
-- enable_if=nil,
|
||||||
-- defaults={condition=nil, if_true={vi=224, vim=0}, if_false=nil},
|
-- defaults={condition=nil, if_true={vi=224, vim=0}, if_false=nil},
|
||||||
-- secure=nil, gettext=nil, noglob=nil, normal_fname_chars=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,
|
-- expand=nil, nodefault=nil, no_mkrc=nil, vi_def=true, vim=true,
|
||||||
-- alloced=nil,
|
-- alloced=nil,
|
||||||
-- save_pv_indir=nil,
|
-- save_pv_indir=nil,
|
||||||
@@ -575,7 +575,7 @@ return {
|
|||||||
full_name='dictionary', abbreviation='dict',
|
full_name='dictionary', abbreviation='dict',
|
||||||
type='string', list='onecomma', scope={'global', 'buffer'},
|
type='string', list='onecomma', scope={'global', 'buffer'},
|
||||||
deny_duplicates=true,
|
deny_duplicates=true,
|
||||||
normal_fname_chars=true,
|
normal_dname_chars=true,
|
||||||
vi_def=true,
|
vi_def=true,
|
||||||
expand=true,
|
expand=true,
|
||||||
varname='p_dict',
|
varname='p_dict',
|
||||||
|
@@ -103,3 +103,18 @@ func Test_keymap_valid()
|
|||||||
call assert_fails(":set kmp=trunc\x00name", "E544:")
|
call assert_fails(":set kmp=trunc\x00name", "E544:")
|
||||||
call assert_fails(":set kmp=trunc\x00name", "trunc")
|
call assert_fails(":set kmp=trunc\x00name", "trunc")
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_dictionary()
|
||||||
|
" Check that it's possible to set the option.
|
||||||
|
set dictionary=/usr/share/dict/words
|
||||||
|
call assert_equal('/usr/share/dict/words', &dictionary)
|
||||||
|
set dictionary=/usr/share/dict/words,/and/there
|
||||||
|
call assert_equal('/usr/share/dict/words,/and/there', &dictionary)
|
||||||
|
set dictionary=/usr/share/dict\ words
|
||||||
|
call assert_equal('/usr/share/dict words', &dictionary)
|
||||||
|
|
||||||
|
" Check rejecting weird characters.
|
||||||
|
call assert_fails("set dictionary=/not&there", "E474:")
|
||||||
|
call assert_fails("set dictionary=/not>there", "E474:")
|
||||||
|
call assert_fails("set dictionary=/not.*there", "E474:")
|
||||||
|
endfunc
|
||||||
|
@@ -850,7 +850,7 @@ static const int included_patches[] = {
|
|||||||
// 105 NA
|
// 105 NA
|
||||||
// 104,
|
// 104,
|
||||||
// 103 NA
|
// 103 NA
|
||||||
// 102,
|
102,
|
||||||
101,
|
101,
|
||||||
100,
|
100,
|
||||||
99,
|
99,
|
||||||
|
Reference in New Issue
Block a user