]> granicus.if.org Git - vim/commitdiff
patch 7.4.2174 v7.4.2174
authorBram Moolenaar <Bram@vim.org>
Sun, 7 Aug 2016 11:48:20 +0000 (13:48 +0200)
committerBram Moolenaar <Bram@vim.org>
Sun, 7 Aug 2016 11:48:20 +0000 (13:48 +0200)
Problem:    Adding duplicate flags to 'whichwrap' leaves commas behind.
Solution:   Also remove the commas. (Naruhiko Nishino)

src/Makefile
src/option.c
src/testdir/Make_all.mak
src/testdir/test_alot.vim
src/testdir/test_options.in [deleted file]
src/testdir/test_options.ok [deleted file]
src/testdir/test_options.vim [new file with mode: 0644]
src/version.c

index 33d8b8c53c3d793b90cf7b57ef0d4843ca82e226..ada714d279f9acc50dc7ca1f80145f80dba4848b 100644 (file)
@@ -2031,7 +2031,6 @@ test1 \
        test_mapping \
        test_marks \
        test_nested_function \
-       test_options \
        test_search_mbyte \
        test_signs \
        test_tagcase \
@@ -2101,6 +2100,7 @@ test_arglist \
        test_menu \
        test_messages \
        test_netbeans \
+       test_options \
        test_packadd \
        test_partial \
        test_perl \
index b9b59eefd014b78e829727ac1a466dc7d4a30296..ff7973fd40e09161a799c0b5137a4105e33d6975 100644 (file)
@@ -4919,12 +4919,30 @@ do_set(
                            {
                                /* Remove flags that appear twice. */
                                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)
+                                   {
+                                       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
                                    {
-                                       STRMOVE(s, s + 1);
-                                       --s;
+                                       if ((!(flags & P_COMMA) || *s != ',')
+                                             && vim_strchr(s + 1, *s) != NULL)
+                                       {
+                                           STRMOVE(s, s + 1);
+                                           --s;
+                                       }
                                    }
+                               }
                            }
 
                            if (save_arg != NULL)   /* number for 'whichwrap' */
index e7e4c680aa62e118b2878fb91b15c9495e55b523..02f2611086e665c923cd4c2a137625c985fa000a 100644 (file)
@@ -101,7 +101,6 @@ SCRIPTS_ALL = \
        test_mapping.out \
        test_marks.out \
        test_nested_function.out \
-       test_options.out \
        test_search_mbyte.out \
        test_signs.out \
        test_tagcase.out \
index 0245fadb45f2f5b37d8890f8c5e9a7f5cc0ebc43..8dd698478d8264c414762cf2cb3224f6dfd3f95d 100644 (file)
@@ -38,3 +38,4 @@ source test_timers.vim
 source test_true_false.vim
 source test_unlet.vim
 source test_window_cmd.vim
+source test_options.vim
diff --git a/src/testdir/test_options.in b/src/testdir/test_options.in
deleted file mode 100644 (file)
index 6e56fa2..0000000
+++ /dev/null
@@ -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
diff --git a/src/testdir/test_options.ok b/src/testdir/test_options.ok
deleted file mode 100644 (file)
index 0773152..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-result
-ok
-foo,,bar
diff --git a/src/testdir/test_options.vim b/src/testdir/test_options.vim
new file mode 100644 (file)
index 0000000..cceb180
--- /dev/null
@@ -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
index 9cf031bdff334185d656f4ae6ccaca07c368ec92..f2d1c79e33cca5b6003c8b88510d304c9c11c060 100644 (file)
@@ -763,6 +763,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2174,
 /**/
     2173,
 /**/