Compare commits

...

7 Commits

Author SHA1 Message Date
Bram Moolenaar
ba748c8a84 patch 8.0.0374: invalid memory access when using :sc in Ex mode
Problem:    Invalid memory access when using :sc in Ex mode. (Dominique Pelle)
Solution:   Avoid the column being negative.  Also fix a hang in Ex mode.
2017-02-26 14:00:07 +01:00
Bram Moolenaar
376407674f patch 8.0.0373: build fails without +folding
Problem:    Build fails without +folding.
Solution:   Move misplaced #ifdef.
2017-02-25 22:37:15 +01:00
Bram Moolenaar
a713ff819d patch 8.0.0372: more options are not always defined
Problem:    More options are not always defined.
Solution:   Consistently define all possible options.
2017-02-25 22:18:43 +01:00
Bram Moolenaar
14c2e18b63 patch 8.0.0371: leaking memory when setting v:completed_item
Problem:    Leaking memory when setting v:completed_item.
Solution:   Or the flags instead of setting them.
2017-02-25 21:39:17 +01:00
Bram Moolenaar
a12e40351d patch 8.0.0370: invalid memory access when setting wildchar empty
Problem:    Invalid memory access when setting wildchar empty.
Solution:   Avoid going over the end of the option value. (Dominique Pelle,
            closes #1509)  Make option test check all number options with
            empty value.
2017-02-25 21:37:57 +01:00
Bram Moolenaar
c43a8b8de0 patch 8.0.0369: a few options are not defined, depending on features
Problem:    The 'balloondelay', 'ballooneval' and 'balloonexpr' options are
            not defined without the +balloon_eval feature. Testing that an
            option value fails does not work for unsupported options.
Solution:   Make the options defined but not supported.  Don't test if
            setting unsupported options fails.
2017-02-25 21:12:29 +01:00
Bram Moolenaar
2f5463df01 patch 8.0.0368: not all options are tested with a range of values
Problem:    Not all options are tested with a range of values.
Solution:   Generate a test script from the source code.
2017-02-25 20:40:46 +01:00
11 changed files with 448 additions and 76 deletions

View File

@@ -97,6 +97,7 @@ SRC_ALL = \
src/tee/tee.c \
src/xxd/xxd.c \
src/main.aap \
src/gen_opt_test.vim \
src/testdir/main.aap \
src/testdir/README.txt \
src/testdir/Make_all.mak \

View File

@@ -2025,6 +2025,7 @@ test check: scripttests unittests
#
scripttests:
$(MAKE) -f Makefile $(VIMTARGET)
$(MAKE) -f Makefile testdir/opt_test.vim
if test -n "$(MAKEMO)" -a -f $(PODIR)/Makefile; then \
cd $(PODIR); $(MAKE) -f Makefile check VIM=../$(VIMTARGET); \
fi
@@ -2033,6 +2034,8 @@ scripttests:
fi
cd testdir; $(MAKE) -f Makefile $(GUI_TESTTARGET) VIMPROG=../$(VIMTARGET) $(GUI_TESTARG) SCRIPTSOURCE=../$(SCRIPTSOURCE)
testdir/opt_test.vim: option.c gen_opt_test.vim
./$(VIMTARGET) -u gen_opt_test.vim --noplugin --not-a-term
# Run the tests with the GUI. Assumes vim/gvim was already built
testgui:
@@ -2753,6 +2756,7 @@ clean celan: testclean
-rm -f *.o objects/* core $(VIMTARGET).core $(VIMTARGET) vim xxd/*.o
-rm -f $(TOOLS) auto/osdef.h auto/pathdef.c auto/if_perl.c auto/gui_gtk_gresources.c auto/gui_gtk_gresources.h
-rm -f conftest* *~ auto/link.sed
-rm -f testdir/opt_test.vim
-rm -f $(UNITTEST_TARGETS)
-rm -f runtime pixmaps
-rm -rf $(APPDIR)
@@ -2767,7 +2771,7 @@ SHADOWDIR = shadow
shadow: runtime pixmaps
mkdir $(SHADOWDIR)
cd $(SHADOWDIR); ln -s ../*.[chm] ../*.in ../*.sh ../*.xs ../*.xbm ../gui_gtk_res.xml ../toolcheck ../proto ../vimtutor ../gvimtutor ../mkinstalldirs .
cd $(SHADOWDIR); ln -s ../*.[chm] ../*.in ../*.vim ../*.sh ../*.xs ../*.xbm ../gui_gtk_res.xml ../toolcheck ../proto ../vimtutor ../gvimtutor ../mkinstalldirs .
mkdir $(SHADOWDIR)/auto
cd $(SHADOWDIR)/auto; ln -s ../../auto/configure .
mkdir $(SHADOWDIR)/po

View File

@@ -6640,7 +6640,7 @@ set_vim_var_dict(int idx, dict_T *val)
if (HASHITEM_EMPTY(hi))
continue;
--todo;
HI2DI(hi)->di_flags = DI_FLAGS_RO | DI_FLAGS_FIX;
HI2DI(hi)->di_flags |= DI_FLAGS_RO | DI_FLAGS_FIX;
}
}
}

View File

@@ -5288,6 +5288,8 @@ do_sub(exarg_T *eap)
getvcol(curwin, &curwin->w_cursor, &sc, NULL, NULL);
curwin->w_cursor.col = regmatch.endpos[0].col - 1;
if (curwin->w_cursor.col < 0)
curwin->w_cursor.col = 0;
getvcol(curwin, &curwin->w_cursor, NULL, NULL, &ec);
if (subflags.do_number || curwin->w_p_nu)
{

View File

@@ -2369,9 +2369,16 @@ getexmodeline(
if (ga_grow(&line_ga, 40) == FAIL)
break;
/* Get one character at a time. */
/*
* Get one character at a time.
*/
prev_char = c1;
c1 = vgetc();
/* Check for a ":normal" command and no more characters left. */
if (ex_normal_busy > 0 && typebuf.tb_len == 0)
c1 = '\n';
else
c1 = vgetc();
/*
* Handle line editing.

195
src/gen_opt_test.vim Normal file
View File

@@ -0,0 +1,195 @@
" Script to generate testdir/opt_test.vim from option.c
if 0
finish
endif
set cpo=&vim
set nomore
let script = [
\ 'let save_columns = &columns',
\ 'let save_lines = &lines',
\ 'let save_term = &term',
\ ]
edit option.c
/#define p_term
let end = line('.')
" Two lists with values: values that work and values that fail.
" When not listed, "othernum" or "otherstring" is used.
let test_values = {
\ 'cmdheight': [[1, 2, 10], [-1, 0]],
\ 'cmdwinheight': [[1, 2, 10], [-1, 0]],
\ 'columns': [[12, 80], [-1, 0, 10]],
\ 'conceallevel': [[0, 1, 2, 3], [-1, 4, 99]],
\ 'foldcolumn': [[0, 1, 4, 12], [-1, 13, 999]],
\ 'helpheight': [[0, 10, 100], [-1]],
\ 'history': [[0, 1, 100], [-1, 10001]],
\ 'iminsert': [[0, 1], [-1, 3, 999]],
\ 'imsearch': [[-1, 0, 1], [-2, 3, 999]],
\ 'lines': [[2, 24], [-1, 0, 1]],
\ 'numberwidth': [[1, 4, 8, 10], [-1, 0, 11]],
\ 'regexpengine': [[0, 1, 2], [-1, 3, 999]],
\ 'report': [[0, 1, 2, 9999], [-1]],
\ 'scroll': [[0, 1, 2, 20], [-1]],
\ 'scrolljump': [[-50, -1, 0, 1, 2, 20], [999]],
\ 'scrolloff': [[0, 1, 2, 20], [-1]],
\ 'shiftwidth': [[0, 1, 8, 999], [-1]],
\ 'sidescroll': [[0, 1, 8, 999], [-1]],
\ 'sidescrolloff': [[0, 1, 8, 999], [-1]],
\ 'tabstop': [[1, 4, 8, 12], [-1, 0]],
\ 'textwidth': [[0, 1, 8, 99], [-1]],
\ 'timeoutlen': [[0, 8, 99999], [-1]],
\ 'titlelen': [[0, 1, 8, 9999], [-1]],
\ 'updatecount': [[0, 1, 8, 9999], [-1]],
\ 'updatetime': [[0, 1, 8, 9999], [-1]],
\ 'verbose': [[-1, 0, 1, 8, 9999], []],
\ 'wildcharm': [[-1, 0, 100], []],
\ 'winheight': [[1, 10, 999], [-1, 0]],
\ 'winminheight': [[0, 1], [-1]],
\ 'winminwidth': [[0, 1, 10], [-1]],
\ 'winwidth': [[1, 10, 999], [-1, 0]],
\
\ 'ambiwidth': [['', 'single'], ['xxx']],
\ 'background': [['', 'light', 'dark'], ['xxx']],
\ 'backspace': [[0, 2, '', 'eol', 'eol,start'], ['xxx']],
\ 'backupcopy': [['yes', 'auto'], ['', 'xxx', 'yes,no']],
\ 'backupext': [['xxx'], ['']],
\ 'belloff': [['', 'all', 'copy,error'], ['xxx']],
\ 'breakindentopt': [['', 'min:3', 'sbr'], ['xxx', 'min', 'min:x']],
\ 'browsedir': [['', 'last', '/tmp/'], ['xxx']],
\ 'bufhidden': [['', 'hide', 'wipe'], ['xxx', 'hide,wipe']],
\ 'buftype': [['', 'help', 'nofile'], ['xxx', 'help,nofile']],
\ 'casemap': [['', 'internal'], ['xxx']],
\ 'cedit': [['', '\<Esc>'], ['xxx', 'f']],
\ 'clipboard': [['', 'unnamed', 'autoselect,unnamed'], ['xxx']],
\ 'colorcolumn': [['', '8', '+2'], ['xxx']],
\ 'comments': [['', 'b:#'], ['xxx']],
\ 'commentstring': [['', '/*%s*/'], ['xxx']],
\ 'complete': [['', 'w,b'], ['xxx']],
\ 'concealcursor': [['', 'n', 'nvic'], ['xxx']],
\ 'completeopt': [['', 'menu', 'menu,longest'], ['xxx', 'menu,,,longest,']],
\ 'cryptmethod': [['', 'zip'], ['xxx']],
\ 'cscopequickfix': [['', 's-', 's-,c+,e0'], ['xxx', 's,g,d']],
\ 'debug': [['', 'msg', 'msg', 'beep'], ['xxx']],
\ 'diffopt': [['', 'filler', 'icase,iwhite'], ['xxx']],
\ 'display': [['', 'lastline', 'lastline,uhex'], ['xxx']],
\ 'eadirection': [['', 'both', 'ver'], ['xxx', 'ver,hor']],
\ 'encoding': [['latin1'], ['xxx', '']],
\ 'eventignore': [['', 'WinEnter', 'WinLeave,winenter'], ['xxx']],
\ 'fileencoding': [['', 'latin1', 'xxx'], []],
\ 'fileformat': [['', 'dos', 'unix'], ['xxx']],
\ 'fileformats': [['', 'dos', 'dos,unix'], ['xxx']],
\ 'fillchars': [['', 'vert:x'], ['xxx']],
\ 'foldclose': [['', 'all'], ['xxx']],
\ 'foldmethod': [['manual', 'indent'], ['', 'xxx', 'expr,diff']],
\ 'foldopen': [['', 'all', 'hor,jump'], ['xxx']],
\ 'foldmarker': [['((,))'], ['', 'xxx']],
\ 'formatoptions': [['', 'vt', 'v,t'], ['xxx']],
\ 'guicursor': [['', 'n:block-Cursor'], ['xxx']],
\ 'helplang': [['', 'de', 'de,it'], ['xxx']],
\ 'highlight': [['', 'e:Error'], ['xxx']],
\ 'isfname': [['', '@', '@,48-52'], ['xxx', '@48']],
\ 'isident': [['', '@', '@,48-52'], ['xxx', '@48']],
\ 'iskeyword': [['', '@', '@,48-52'], ['xxx', '@48']],
\ 'isprint': [['', '@', '@,48-52'], ['xxx', '@48']],
\ 'keymap': [['', 'accents'], ['xxx']],
\ 'keymodel': [['', 'startsel', 'startsel,stopsel'], ['xxx']],
\ 'langmap': [['', 'xX', 'aA,bB'], ['xxx']],
\ 'listchars': [['', 'eol:x', 'eol:x,space:y'], ['xxx']],
\ 'matchpairs': [['', '(:)', '(:),<:>'], ['xxx']],
\ 'mkspellmem': [['10000,100,12'], ['', 'xxx']],
\ 'mouse': [['', 'a', 'nvi'], ['xxx', 'n,v,i']],
\ 'mousemodel': [['', 'popup'], ['xxx']],
\ 'mouseshape': [['', 'n:arrow'], ['xxx']],
\ 'nrformats': [['', 'alpha', 'alpha,hex,bin'], ['xxx']],
\ 'printmbfont': [['', 'r:some', 'b:Bold,c:yes'], ['xxx']],
\ 'printoptions': [['', 'header:0', 'left:10pc,top:5pc'], ['xxx']],
\ 'scrollopt': [['', 'ver', 'ver,hor'], ['xxx']],
\ 'selection': [['old', 'inclusive'], ['', 'xxx']],
\ 'selectmode': [['', 'mouse', 'key,cmd'], ['xxx']],
\ 'sessionoptions': [['', 'blank', 'help,options,slash'], ['xxx']],
\ 'signcolumn': [['', 'auto', 'no'], ['xxx', 'no,yes']],
\ 'spellfile': [['', 'file.en.add'], ['xxx', '/tmp/file']],
\ 'spellsuggest': [['', 'best', 'double,33'], ['xxx']],
\ 'switchbuf': [['', 'useopen', 'split,newtab'], ['xxx']],
\ 'tagcase': [['smart', 'match'], ['', 'xxx', 'smart,match']],
\ 'term': [['ansi'], ['', 'gui']],
\ 'toolbar': [['', 'icons', 'text'], ['xxx']],
\ 'toolbariconsize': [['', 'tiny', 'huge'], ['xxx']],
\ 'ttymouse': [['', 'xterm'], ['xxx']],
\ 'ttytype': [['ansi'], ['', 'gui']],
\ 'viewoptions': [['', 'cursor', 'unix,slash'], ['xxx']],
\ 'viminfo': [['', '''50', '"30'], ['xxx']],
\ 'virtualedit': [['', 'all', 'all,block'], ['xxx']],
\ 'whichwrap': [['', 'b,s', 'bs'], ['xxx']],
\ 'wildmode': [['', 'full', 'list:full', 'full,longest'], ['xxx']],
\ 'wildoptions': [['', 'tagfile'], ['xxx']],
\ 'winaltkeys': [['menu', 'no'], ['', 'xxx']],
\
\ 'luadll': [[], []],
\ 'macatsui': [[], []],
\ 'perldll': [[], []],
\ 'pythondll': [[], []],
\ 'pythonthreedll': [[], []],
\ 'pyxversion': [[], []],
\ 'rubydll': [[], []],
\ 'tcldll': [[], []],
\
\ 'othernum': [[-1, 0, 100], ['']],
\ 'otherstring': [['', 'xxx'], []],
\}
1
/struct vimoption options
while 1
/{"
if line('.') > end
break
endif
let line = getline('.')
let name = substitute(line, '.*{"\([^"]*\)".*', '\1', '')
let shortname = substitute(line, '.*"\([^"]*\)".*', '\1', '')
if has_key(test_values, name)
let a = test_values[name]
elseif line =~ 'P_NUM'
let a = test_values['othernum']
else
let a = test_values['otherstring']
endif
if len(a[0]) > 0 || len(a[1]) > 0
if line =~ 'P_BOOL'
call add(script, 'set ' . name)
call add(script, 'set ' . shortname)
call add(script, 'set no' . name)
call add(script, 'set no' . shortname)
else
for val in a[0]
call add(script, 'set ' . name . '=' . val)
call add(script, 'set ' . shortname . '=' . val)
endfor
" setting an option can only fail when it's implemented.
call add(script, "if exists('+" . name . "')")
for val in a[1]
call add(script, "call assert_fails('set " . name . "=" . val . "')")
call add(script, "call assert_fails('set " . shortname . "=" . val . "')")
endfor
call add(script, "endif")
endif
call add(script, 'set ' . name . '&')
call add(script, 'set ' . shortname . '&')
endif
endwhile
call add(script, 'let &term = save_term')
call add(script, 'let &columns = save_columns')
call add(script, 'let &lines = save_lines')
call writefile(script, 'testdir/opt_test.vim')
qa!

View File

@@ -559,11 +559,15 @@ static struct vimoption options[] =
{(char_u *)0L, (char_u *)0L}
#endif
SCRIPTID_INIT},
#ifdef FEAT_AUTOCHDIR
{"autochdir", "acd", P_BOOL|P_VI_DEF,
#ifdef FEAT_AUTOCHDIR
(char_u *)&p_acd, PV_NONE,
{(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT},
{(char_u *)FALSE, (char_u *)0L}
#else
(char_u *)NULL, PV_NONE,
{(char_u *)0L, (char_u *)0L}
#endif
SCRIPTID_INIT},
{"autoindent", "ai", P_BOOL|P_VI_DEF,
(char_u *)&p_ai, PV_AI,
{(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT},
@@ -624,19 +628,33 @@ static struct vimoption options[] =
{(char_u *)0L, (char_u *)0L}
#endif
SCRIPTID_INIT},
#ifdef FEAT_BEVAL
{"balloondelay","bdlay",P_NUM|P_VI_DEF,
#ifdef FEAT_BEVAL
(char_u *)&p_bdlay, PV_NONE,
{(char_u *)600L, (char_u *)0L} SCRIPTID_INIT},
{"ballooneval", "beval",P_BOOL|P_VI_DEF|P_NO_MKRC,
(char_u *)&p_beval, PV_NONE,
{(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT},
# ifdef FEAT_EVAL
{"balloonexpr", "bexpr", P_STRING|P_ALLOCED|P_VI_DEF|P_VIM,
(char_u *)&p_bexpr, PV_BEXPR,
{(char_u *)"", (char_u *)0L} SCRIPTID_INIT},
# endif
{(char_u *)600L, (char_u *)0L}
#else
(char_u *)NULL, PV_NONE,
{(char_u *)0L, (char_u *)0L}
#endif
SCRIPTID_INIT},
{"ballooneval", "beval",P_BOOL|P_VI_DEF|P_NO_MKRC,
#ifdef FEAT_BEVAL
(char_u *)&p_beval, PV_NONE,
{(char_u *)FALSE, (char_u *)0L}
#else
(char_u *)NULL, PV_NONE,
{(char_u *)0L, (char_u *)0L}
#endif
SCRIPTID_INIT},
{"balloonexpr", "bexpr", P_STRING|P_ALLOCED|P_VI_DEF|P_VIM,
#if defined(FEAT_BEVAL) && defined(FEAT_EVAL)
(char_u *)&p_bexpr, PV_BEXPR,
{(char_u *)"", (char_u *)0L}
#else
(char_u *)NULL, PV_NONE,
{(char_u *)0L, (char_u *)0L}
#endif
SCRIPTID_INIT},
{"beautify", "bf", P_BOOL|P_VI_DEF,
(char_u *)NULL, PV_NONE,
{(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT},
@@ -1196,62 +1214,125 @@ static struct vimoption options[] =
{"flash", "fl", P_BOOL|P_VI_DEF,
(char_u *)NULL, PV_NONE,
{(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT},
#ifdef FEAT_FOLDING
{"foldclose", "fcl", P_STRING|P_VI_DEF|P_ONECOMMA|P_NODUP|P_RWIN,
#ifdef FEAT_FOLDING
(char_u *)&p_fcl, PV_NONE,
{(char_u *)"", (char_u *)0L} SCRIPTID_INIT},
{(char_u *)"", (char_u *)0L}
#else
(char_u *)NULL, PV_NONE,
{(char_u *)NULL, (char_u *)0L}
#endif
SCRIPTID_INIT},
{"foldcolumn", "fdc", P_NUM|P_VI_DEF|P_RWIN,
#ifdef FEAT_FOLDING
(char_u *)VAR_WIN, PV_FDC,
{(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT},
{(char_u *)FALSE, (char_u *)0L}
#else
(char_u *)NULL, PV_NONE,
{(char_u *)NULL, (char_u *)0L}
#endif
SCRIPTID_INIT},
{"foldenable", "fen", P_BOOL|P_VI_DEF|P_RWIN,
#ifdef FEAT_FOLDING
(char_u *)VAR_WIN, PV_FEN,
{(char_u *)TRUE, (char_u *)0L} SCRIPTID_INIT},
{(char_u *)TRUE, (char_u *)0L}
#else
(char_u *)NULL, PV_NONE,
{(char_u *)NULL, (char_u *)0L}
#endif
SCRIPTID_INIT},
{"foldexpr", "fde", P_STRING|P_ALLOCED|P_VIM|P_VI_DEF|P_RWIN,
# ifdef FEAT_EVAL
#if defined(FEAT_FOLDING) && defined(FEAT_EVAL)
(char_u *)VAR_WIN, PV_FDE,
{(char_u *)"0", (char_u *)NULL}
# else
#else
(char_u *)NULL, PV_NONE,
{(char_u *)NULL, (char_u *)0L}
# endif
#endif
SCRIPTID_INIT},
{"foldignore", "fdi", P_STRING|P_ALLOCED|P_VIM|P_VI_DEF|P_RWIN,
#ifdef FEAT_FOLDING
(char_u *)VAR_WIN, PV_FDI,
{(char_u *)"#", (char_u *)NULL} SCRIPTID_INIT},
{"foldlevel", "fdl", P_NUM|P_VI_DEF|P_RWIN,
(char_u *)VAR_WIN, PV_FDL,
{(char_u *)0L, (char_u *)0L} SCRIPTID_INIT},
{"foldlevelstart","fdls", P_NUM|P_VI_DEF|P_CURSWANT,
(char_u *)&p_fdls, PV_NONE,
{(char_u *)-1L, (char_u *)0L} SCRIPTID_INIT},
{"foldmarker", "fmr", P_STRING|P_ALLOCED|P_VIM|P_VI_DEF|
P_RWIN|P_ONECOMMA|P_NODUP,
(char_u *)VAR_WIN, PV_FMR,
{(char_u *)"{{{,}}}", (char_u *)NULL}
SCRIPTID_INIT},
{"foldmethod", "fdm", P_STRING|P_ALLOCED|P_VIM|P_VI_DEF|P_RWIN,
(char_u *)VAR_WIN, PV_FDM,
{(char_u *)"manual", (char_u *)NULL} SCRIPTID_INIT},
{"foldminlines","fml", P_NUM|P_VI_DEF|P_RWIN,
(char_u *)VAR_WIN, PV_FML,
{(char_u *)1L, (char_u *)0L} SCRIPTID_INIT},
{"foldnestmax", "fdn", P_NUM|P_VI_DEF|P_RWIN,
(char_u *)VAR_WIN, PV_FDN,
{(char_u *)20L, (char_u *)0L} SCRIPTID_INIT},
{"foldopen", "fdo", P_STRING|P_VI_DEF|P_ONECOMMA|P_NODUP|P_CURSWANT,
(char_u *)&p_fdo, PV_NONE,
{(char_u *)"block,hor,mark,percent,quickfix,search,tag,undo",
(char_u *)0L} SCRIPTID_INIT},
{"foldtext", "fdt", P_STRING|P_ALLOCED|P_VIM|P_VI_DEF|P_RWIN,
# ifdef FEAT_EVAL
(char_u *)VAR_WIN, PV_FDT,
{(char_u *)"foldtext()", (char_u *)NULL}
# else
{(char_u *)"#", (char_u *)NULL}
#else
(char_u *)NULL, PV_NONE,
{(char_u *)NULL, (char_u *)0L}
# endif
SCRIPTID_INIT},
#endif
SCRIPTID_INIT},
{"foldlevel", "fdl", P_NUM|P_VI_DEF|P_RWIN,
#ifdef FEAT_FOLDING
(char_u *)VAR_WIN, PV_FDL,
{(char_u *)0L, (char_u *)0L}
#else
(char_u *)NULL, PV_NONE,
{(char_u *)NULL, (char_u *)0L}
#endif
SCRIPTID_INIT},
{"foldlevelstart","fdls", P_NUM|P_VI_DEF|P_CURSWANT,
#ifdef FEAT_FOLDING
(char_u *)&p_fdls, PV_NONE,
{(char_u *)-1L, (char_u *)0L}
#else
(char_u *)NULL, PV_NONE,
{(char_u *)NULL, (char_u *)0L}
#endif
SCRIPTID_INIT},
{"foldmarker", "fmr", P_STRING|P_ALLOCED|P_VIM|P_VI_DEF|
P_RWIN|P_ONECOMMA|P_NODUP,
#ifdef FEAT_FOLDING
(char_u *)VAR_WIN, PV_FMR,
{(char_u *)"{{{,}}}", (char_u *)NULL}
#else
(char_u *)NULL, PV_NONE,
{(char_u *)NULL, (char_u *)0L}
#endif
SCRIPTID_INIT},
{"foldmethod", "fdm", P_STRING|P_ALLOCED|P_VIM|P_VI_DEF|P_RWIN,
#ifdef FEAT_FOLDING
(char_u *)VAR_WIN, PV_FDM,
{(char_u *)"manual", (char_u *)NULL}
#else
(char_u *)NULL, PV_NONE,
{(char_u *)NULL, (char_u *)0L}
#endif
SCRIPTID_INIT},
{"foldminlines","fml", P_NUM|P_VI_DEF|P_RWIN,
#ifdef FEAT_FOLDING
(char_u *)VAR_WIN, PV_FML,
{(char_u *)1L, (char_u *)0L}
#else
(char_u *)NULL, PV_NONE,
{(char_u *)NULL, (char_u *)0L}
#endif
SCRIPTID_INIT},
{"foldnestmax", "fdn", P_NUM|P_VI_DEF|P_RWIN,
#ifdef FEAT_FOLDING
(char_u *)VAR_WIN, PV_FDN,
{(char_u *)20L, (char_u *)0L}
#else
(char_u *)NULL, PV_NONE,
{(char_u *)NULL, (char_u *)0L}
#endif
SCRIPTID_INIT},
{"foldopen", "fdo", P_STRING|P_VI_DEF|P_ONECOMMA|P_NODUP|P_CURSWANT,
#ifdef FEAT_FOLDING
(char_u *)&p_fdo, PV_NONE,
{(char_u *)"block,hor,mark,percent,quickfix,search,tag,undo",
(char_u *)0L}
#else
(char_u *)NULL, PV_NONE,
{(char_u *)NULL, (char_u *)0L}
#endif
SCRIPTID_INIT},
{"foldtext", "fdt", P_STRING|P_ALLOCED|P_VIM|P_VI_DEF|P_RWIN,
#if defined(FEAT_FOLDING) && defined(FEAT_EVAL)
(char_u *)VAR_WIN, PV_FDT,
{(char_u *)"foldtext()", (char_u *)NULL}
#else
(char_u *)NULL, PV_NONE,
{(char_u *)NULL, (char_u *)0L}
#endif
SCRIPTID_INIT},
{"formatexpr", "fex", P_STRING|P_ALLOCED|P_VI_DEF|P_VIM,
#ifdef FEAT_EVAL
(char_u *)&p_fex, PV_FEX,
@@ -1789,17 +1870,24 @@ static struct vimoption options[] =
{"loadplugins", "lpl", P_BOOL|P_VI_DEF,
(char_u *)&p_lpl, PV_NONE,
{(char_u *)TRUE, (char_u *)0L} SCRIPTID_INIT},
#if defined(DYNAMIC_LUA)
{"luadll", NULL, P_STRING|P_EXPAND|P_VI_DEF|P_SECURE,
#if defined(DYNAMIC_LUA)
(char_u *)&p_luadll, PV_NONE,
{(char_u *)DYNAMIC_LUA_DLL, (char_u *)0L}
#else
(char_u *)NULL, PV_NONE,
{(char_u *)"", (char_u *)0L}
#endif
SCRIPTID_INIT},
#endif
#ifdef FEAT_GUI_MAC
{"macatsui", NULL, P_BOOL|P_VI_DEF|P_RCLR,
#ifdef FEAT_GUI_MAC
(char_u *)&p_macatsui, PV_NONE,
{(char_u *)TRUE, (char_u *)0L} SCRIPTID_INIT},
{(char_u *)TRUE, (char_u *)0L}
#else
(char_u *)NULL, PV_NONE,
{(char_u *)"", (char_u *)0L}
#endif
SCRIPTID_INIT},
{"magic", NULL, P_BOOL|P_VI_DEF,
(char_u *)&p_magic, PV_NONE,
{(char_u *)TRUE, (char_u *)0L} SCRIPTID_INIT},
@@ -2031,12 +2119,15 @@ static struct vimoption options[] =
(char_u *)".,/usr/include,,",
#endif
(char_u *)0L} SCRIPTID_INIT},
#if defined(DYNAMIC_PERL)
{"perldll", NULL, P_STRING|P_EXPAND|P_VI_DEF|P_SECURE,
#if defined(DYNAMIC_PERL)
(char_u *)&p_perldll, PV_NONE,
{(char_u *)DYNAMIC_PERL_DLL, (char_u *)0L}
SCRIPTID_INIT},
#else
(char_u *)NULL, PV_NONE,
{(char_u *)0L, (char_u *)0L}
#endif
SCRIPTID_INIT},
{"preserveindent", "pi", P_BOOL|P_VI_DEF|P_VIM,
(char_u *)&p_pi, PV_PI,
{(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT},
@@ -2142,18 +2233,24 @@ static struct vimoption options[] =
(char_u *)NULL, PV_NONE,
#endif
{(char_u *)0L, (char_u *)0L} SCRIPTID_INIT},
#if defined(DYNAMIC_PYTHON3)
{"pythonthreedll", NULL, P_STRING|P_EXPAND|P_VI_DEF|P_SECURE,
#if defined(DYNAMIC_PYTHON3)
(char_u *)&p_py3dll, PV_NONE,
{(char_u *)DYNAMIC_PYTHON3_DLL, (char_u *)0L}
SCRIPTID_INIT},
#else
(char_u *)NULL, PV_NONE,
{(char_u *)NULL, (char_u *)0L}
#endif
#if defined(DYNAMIC_PYTHON)
SCRIPTID_INIT},
{"pythondll", NULL, P_STRING|P_EXPAND|P_VI_DEF|P_SECURE,
#if defined(DYNAMIC_PYTHON)
(char_u *)&p_pydll, PV_NONE,
{(char_u *)DYNAMIC_PYTHON_DLL, (char_u *)0L}
SCRIPTID_INIT},
#else
(char_u *)NULL, PV_NONE,
{(char_u *)NULL, (char_u *)0L}
#endif
SCRIPTID_INIT},
{"pyxversion", "pyx", P_NUM|P_VI_DEF|P_SECURE,
#if defined(FEAT_PYTHON) || defined(FEAT_PYTHON3)
(char_u *)&p_pyx, PV_NONE,
@@ -2235,12 +2332,15 @@ static struct vimoption options[] =
{(char_u *)NULL, (char_u *)0L}
#endif
SCRIPTID_INIT},
#if defined(DYNAMIC_RUBY)
{"rubydll", NULL, P_STRING|P_EXPAND|P_VI_DEF|P_SECURE,
#if defined(DYNAMIC_RUBY)
(char_u *)&p_rubydll, PV_NONE,
{(char_u *)DYNAMIC_RUBY_DLL, (char_u *)0L}
SCRIPTID_INIT},
#else
(char_u *)NULL, PV_NONE,
{(char_u *)NULL, (char_u *)0L}
#endif
SCRIPTID_INIT},
{"ruler", "ru", P_BOOL|P_VI_DEF|P_VIM|P_RSTAT,
#ifdef FEAT_CMDL_INFO
(char_u *)&p_ru, PV_NONE,
@@ -2628,12 +2728,15 @@ static struct vimoption options[] =
{"tagstack", "tgst", P_BOOL|P_VI_DEF,
(char_u *)&p_tgst, PV_NONE,
{(char_u *)TRUE, (char_u *)0L} SCRIPTID_INIT},
#if defined(DYNAMIC_TCL)
{"tcldll", NULL, P_STRING|P_EXPAND|P_VI_DEF|P_SECURE,
#if defined(DYNAMIC_TCL)
(char_u *)&p_tcldll, PV_NONE,
{(char_u *)DYNAMIC_TCL_DLL, (char_u *)0L}
SCRIPTID_INIT},
#else
(char_u *)NULL, PV_NONE,
{(char_u *)0L, (char_u *)0L}
#endif
SCRIPTID_INIT},
{"term", NULL, P_STRING|P_EXPAND|P_NODEFAULT|P_NO_MKRC|P_VI_DEF|P_RALL,
(char_u *)&T_NAME, PV_NONE,
{(char_u *)"", (char_u *)0L} SCRIPTID_INIT},
@@ -2728,17 +2831,24 @@ static struct vimoption options[] =
(char_u *)NULL, PV_NONE,
#endif
{(char_u *)"", (char_u *)0L} SCRIPTID_INIT},
#if defined(FEAT_TOOLBAR) && !defined(FEAT_GUI_W32)
{"toolbar", "tb", P_STRING|P_ONECOMMA|P_VI_DEF|P_NODUP,
#if defined(FEAT_TOOLBAR) && !defined(FEAT_GUI_W32)
(char_u *)&p_toolbar, PV_NONE,
{(char_u *)"icons,tooltips", (char_u *)0L}
#else
(char_u *)NULL, PV_NONE,
{(char_u *)0L, (char_u *)0L}
#endif
SCRIPTID_INIT},
#endif
#if defined(FEAT_TOOLBAR) && defined(FEAT_GUI_GTK)
{"toolbariconsize", "tbis", P_STRING|P_VI_DEF,
#if defined(FEAT_TOOLBAR) && defined(FEAT_GUI_GTK)
(char_u *)&p_tbis, PV_NONE,
{(char_u *)"small", (char_u *)0L} SCRIPTID_INIT},
{(char_u *)"small", (char_u *)0L}
#else
(char_u *)NULL, PV_NONE,
{(char_u *)0L, (char_u *)0L}
#endif
SCRIPTID_INIT},
{"ttimeout", NULL, P_BOOL|P_VI_DEF|P_VIM,
(char_u *)&p_ttimeout, PV_NONE,
{(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT},
@@ -4598,7 +4708,7 @@ do_set(
|| (long *)varp == &p_wcm)
&& (*arg == '<'
|| *arg == '^'
|| ((!arg[1] || vim_iswhite(arg[1]))
|| (*arg != NUL && (!arg[1] || vim_iswhite(arg[1]))
&& !VIM_ISDIGIT(*arg))))
{
value = string_to_key(arg);
@@ -5829,7 +5939,7 @@ set_string_option(
opt_flags)) == NULL)
did_set_option(opt_idx, opt_flags, TRUE);
/* call autocomamnd after handling side effects */
/* call autocommand after handling side effects */
#if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL)
if (saved_oldval != NULL)
{

View File

@@ -14,7 +14,7 @@ func s:test_expand_dllpath(optname)
endfunc
func s:generate_test_if_exists(optname)
if exists('&' . a:optname)
if exists('+' . a:optname)
execute join([
\ 'func Test_expand_' . a:optname . '()',
\ ' call s:test_expand_dllpath("' . a:optname . '")',

View File

@@ -29,6 +29,19 @@ function! Test_isfname()
set isfname&
endfunction
function Test_wildchar()
" Empty 'wildchar' used to access invalid memory.
call assert_fails('set wildchar=', 'E521:')
call assert_fails('set wildchar=abc', 'E521:')
set wildchar=<Esc>
let a=execute('set wildchar?')
call assert_equal("\n wildchar=<Esc>", a)
set wildchar=27
let a=execute('set wildchar?')
call assert_equal("\n wildchar=<Esc>", a)
set wildchar&
endfunction
function Test_options()
let caught = 'ok'
try
@@ -275,3 +288,21 @@ func Test_set_ttytype()
call assert_equal(&ttytype, &term)
endif
endfunc
func Test_set_all()
set tw=75
set iskeyword=a-z,A-Z
set nosplitbelow
let out = execute('set all')
call assert_match('textwidth=75', out)
call assert_match('iskeyword=a-z,A-Z', out)
call assert_match('nosplitbelow', out)
set tw& iskeyword& splitbelow&
endfunc
func Test_set_values()
" The file is only generated when running "make test" in the src directory.
if filereadable('opt_test.vim')
source opt_test.vim
endif
endfunc

View File

@@ -106,3 +106,11 @@ function! Test_substitute_variants()
endfor
endfor
endfunction
func Test_substitute_repeat()
" This caused an invalid memory access.
split Xfile
s/^/x
call feedkeys("Qsc\<CR>y", 'tx')
bwipe!
endfunc

View File

@@ -764,6 +764,20 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
374,
/**/
373,
/**/
372,
/**/
371,
/**/
370,
/**/
369,
/**/
368,
/**/
367,
/**/