forked from aniani/vim
patch 7.4.2174
Problem: Adding duplicate flags to 'whichwrap' leaves commas behind. Solution: Also remove the commas. (Naruhiko Nishino)
This commit is contained in:
@@ -2031,7 +2031,6 @@ test1 \
|
|||||||
test_mapping \
|
test_mapping \
|
||||||
test_marks \
|
test_marks \
|
||||||
test_nested_function \
|
test_nested_function \
|
||||||
test_options \
|
|
||||||
test_search_mbyte \
|
test_search_mbyte \
|
||||||
test_signs \
|
test_signs \
|
||||||
test_tagcase \
|
test_tagcase \
|
||||||
@@ -2101,6 +2100,7 @@ test_arglist \
|
|||||||
test_menu \
|
test_menu \
|
||||||
test_messages \
|
test_messages \
|
||||||
test_netbeans \
|
test_netbeans \
|
||||||
|
test_options \
|
||||||
test_packadd \
|
test_packadd \
|
||||||
test_partial \
|
test_partial \
|
||||||
test_perl \
|
test_perl \
|
||||||
|
26
src/option.c
26
src/option.c
@@ -4919,12 +4919,30 @@ do_set(
|
|||||||
{
|
{
|
||||||
/* Remove flags that appear twice. */
|
/* Remove flags that appear twice. */
|
||||||
for (s = newval; *s; ++s)
|
for (s = newval; *s; ++s)
|
||||||
if ((!(flags & P_COMMA) || *s != ',')
|
{
|
||||||
&& vim_strchr(s + 1, *s) != NULL)
|
/* if options have P_FLAGLIST and
|
||||||
|
* P_ONECOMMA such as 'whichwrap' */
|
||||||
|
if (flags & P_ONECOMMA)
|
||||||
{
|
{
|
||||||
STRMOVE(s, s + 1);
|
if (*s != ',' && *(s + 1) == ','
|
||||||
--s;
|
&& vim_strchr(s + 2, *s) != NULL)
|
||||||
|
{
|
||||||
|
/* Remove the duplicated value and
|
||||||
|
* the next comma. */
|
||||||
|
STRMOVE(s, s + 2);
|
||||||
|
s -= 2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ((!(flags & P_COMMA) || *s != ',')
|
||||||
|
&& vim_strchr(s + 1, *s) != NULL)
|
||||||
|
{
|
||||||
|
STRMOVE(s, s + 1);
|
||||||
|
--s;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (save_arg != NULL) /* number for 'whichwrap' */
|
if (save_arg != NULL) /* number for 'whichwrap' */
|
||||||
|
@@ -101,7 +101,6 @@ SCRIPTS_ALL = \
|
|||||||
test_mapping.out \
|
test_mapping.out \
|
||||||
test_marks.out \
|
test_marks.out \
|
||||||
test_nested_function.out \
|
test_nested_function.out \
|
||||||
test_options.out \
|
|
||||||
test_search_mbyte.out \
|
test_search_mbyte.out \
|
||||||
test_signs.out \
|
test_signs.out \
|
||||||
test_tagcase.out \
|
test_tagcase.out \
|
||||||
|
@@ -38,3 +38,4 @@ source test_timers.vim
|
|||||||
source test_true_false.vim
|
source test_true_false.vim
|
||||||
source test_unlet.vim
|
source test_unlet.vim
|
||||||
source test_window_cmd.vim
|
source test_window_cmd.vim
|
||||||
|
source test_options.vim
|
||||||
|
@@ -1,23 +0,0 @@
|
|||||||
Test for ":options".
|
|
||||||
|
|
||||||
STARTTEST
|
|
||||||
:so small.vim
|
|
||||||
:let caught = 'ok'
|
|
||||||
:try
|
|
||||||
:options
|
|
||||||
:catch
|
|
||||||
:let caught = v:throwpoint . "\n" . v:exception
|
|
||||||
:endtry
|
|
||||||
:buf 1
|
|
||||||
:$put =caught
|
|
||||||
:"
|
|
||||||
:" Test that changing 'path' keeps two commas.
|
|
||||||
:set path=foo,,bar
|
|
||||||
:set path-=bar
|
|
||||||
:set path+=bar
|
|
||||||
:$put =&path
|
|
||||||
:/^result/,$w! test.out
|
|
||||||
:qa!
|
|
||||||
ENDTEST
|
|
||||||
|
|
||||||
result
|
|
@@ -1,3 +0,0 @@
|
|||||||
result
|
|
||||||
ok
|
|
||||||
foo,,bar
|
|
40
src/testdir/test_options.vim
Normal file
40
src/testdir/test_options.vim
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
" Test for options
|
||||||
|
|
||||||
|
function! Test_whichwrap()
|
||||||
|
set whichwrap=b,s
|
||||||
|
call assert_equal('b,s', &whichwrap)
|
||||||
|
|
||||||
|
set whichwrap+=h,l
|
||||||
|
call assert_equal('b,s,h,l', &whichwrap)
|
||||||
|
|
||||||
|
set whichwrap+=h,l
|
||||||
|
call assert_equal('b,s,h,l', &whichwrap)
|
||||||
|
|
||||||
|
set whichwrap+=h,l
|
||||||
|
call assert_equal('b,s,h,l', &whichwrap)
|
||||||
|
|
||||||
|
set whichwrap&
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! Test_options()
|
||||||
|
let caught = 'ok'
|
||||||
|
try
|
||||||
|
options
|
||||||
|
catch
|
||||||
|
let caught = v:throwpoint . "\n" . v:exception
|
||||||
|
endtry
|
||||||
|
call assert_equal('ok', caught)
|
||||||
|
|
||||||
|
" close option-window
|
||||||
|
close
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! Test_path_keep_commas()
|
||||||
|
" Test that changing 'path' keeps two commas.
|
||||||
|
set path=foo,,bar
|
||||||
|
set path-=bar
|
||||||
|
set path+=bar
|
||||||
|
call assert_equal('foo,,bar', &path)
|
||||||
|
|
||||||
|
set path&
|
||||||
|
endfunction
|
@@ -763,6 +763,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
2174,
|
||||||
/**/
|
/**/
|
||||||
2173,
|
2173,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user