To: vim_dev@googlegroups.com Subject: Patch 7.4.2174 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 7.4.2174 Problem: Adding duplicate flags to 'whichwrap' leaves commas behind. Solution: Also remove the commas. (Naruhiko Nishino) Files: src/Makefile, src/option.c, src/testdir/Make_all.mak, src/testdir/test_alot.vim, src/testdir/test_options.in, src/testdir/test_options.ok, src/testdir/test_options.vim *** ../vim-7.4.2173/src/Makefile 2016-08-06 15:29:07.237549821 +0200 --- src/Makefile 2016-08-07 13:38:52.981453457 +0200 *************** *** 2031,2037 **** test_mapping \ test_marks \ test_nested_function \ - test_options \ test_search_mbyte \ test_signs \ test_tagcase \ --- 2031,2036 ---- *************** *** 2101,2106 **** --- 2100,2106 ---- test_menu \ test_messages \ test_netbeans \ + test_options \ test_packadd \ test_partial \ test_perl \ *** ../vim-7.4.2173/src/option.c 2016-07-24 21:58:39.712057561 +0200 --- src/option.c 2016-08-07 13:45:38.614269698 +0200 *************** *** 4919,4930 **** { /* Remove flags that appear twice. */ for (s = newval; *s; ++s) ! if ((!(flags & P_COMMA) || *s != ',') ! && vim_strchr(s + 1, *s) != NULL) { ! STRMOVE(s, s + 1); ! --s; } } if (save_arg != NULL) /* number for 'whichwrap' */ --- 4919,4948 ---- { /* Remove flags that appear twice. */ for (s = newval; *s; ++s) ! { ! /* if options have P_FLAGLIST and ! * P_ONECOMMA such as 'whichwrap' */ ! if (flags & P_ONECOMMA) { ! if (*s != ',' && *(s + 1) == ',' ! && 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' */ *** ../vim-7.4.2173/src/testdir/Make_all.mak 2016-08-06 15:29:07.237549821 +0200 --- src/testdir/Make_all.mak 2016-08-07 13:38:18.553723665 +0200 *************** *** 101,107 **** test_mapping.out \ test_marks.out \ test_nested_function.out \ - test_options.out \ test_search_mbyte.out \ test_signs.out \ test_tagcase.out \ --- 101,106 ---- *** ../vim-7.4.2173/src/testdir/test_alot.vim 2016-08-06 15:29:07.237549821 +0200 --- src/testdir/test_alot.vim 2016-08-07 13:38:18.553723665 +0200 *************** *** 38,40 **** --- 38,41 ---- source test_true_false.vim source test_unlet.vim source test_window_cmd.vim + source test_options.vim *** ../vim-7.4.2173/src/testdir/test_options.in 2015-11-10 17:50:20.713430521 +0100 --- src/testdir/test_options.in 1970-01-01 01:00:00.000000000 +0100 *************** *** 1,23 **** - 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 --- 0 ---- *** ../vim-7.4.2173/src/testdir/test_options.ok 2015-11-10 17:50:20.717430483 +0100 --- src/testdir/test_options.ok 1970-01-01 01:00:00.000000000 +0100 *************** *** 1,3 **** - result - ok - foo,,bar --- 0 ---- *** ../vim-7.4.2173/src/testdir/test_options.vim 2016-08-07 13:47:39.549315226 +0200 --- src/testdir/test_options.vim 2016-08-07 13:38:18.553723665 +0200 *************** *** 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 *** ../vim-7.4.2173/src/version.c 2016-08-06 23:03:55.790030629 +0200 --- src/version.c 2016-08-07 13:47:18.501485663 +0200 *************** *** 765,766 **** --- 765,768 ---- { /* Add new patch number below this line */ + /**/ + 2174, /**/ -- If you had to identify, in one word, the reason why the human race has not achieved, and never will achieve, its full potential, that word would be "meetings." /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///