]> granicus.if.org Git - vim/commitdiff
patch 7.4.915 v7.4.915
authorBram Moolenaar <Bram@vim.org>
Tue, 10 Nov 2015 16:50:24 +0000 (17:50 +0100)
committerBram Moolenaar <Bram@vim.org>
Tue, 10 Nov 2015 16:50:24 +0000 (17:50 +0100)
Problem:    When removing from 'path' and then adding, a comma may go missing.
            (Malcolm Rowe)
Solution:   Fix the check for P_ONECOMMA. (closes #471)

src/option.c
src/testdir/test_options.in
src/testdir/test_options.ok
src/version.c

index db3a197af4bce9b44d7ae7ba38817bf78d076882..bc44cb2d4bde9c7c13a7436acad80b1c63d3df70 100644 (file)
@@ -4883,9 +4883,10 @@ do_set(arg, opt_flags)
                                {
                                    i = (int)STRLEN(origval);
                                    /* strip a trailing comma, would get 2 */
-                                   if (comma && (flags & P_ONECOMMA) && i > 1
-                                                   && origval[i - 1] == ','
-                                                   && origval[i - 2] != '\\')
+                                   if (comma && i > 1
+                                         && (flags & P_ONECOMMA) == P_ONECOMMA
+                                         && origval[i - 1] == ','
+                                         && origval[i - 2] != '\\')
                                        i--;
                                    mch_memmove(newval + i + comma, newval,
                                                          STRLEN(newval) + 1);
index bf1232a223474ae0267e5310faff181de53cebf5..6e56fa24271eae0b4680c6174f43e89dce4658ad 100644 (file)
@@ -10,6 +10,12 @@ STARTTEST
 :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
index a2e1494a1f60f32ab22f06646db7a4ef7c6218ca..07731526bcf6dc86a19d8f703704a4a1175aa665 100644 (file)
@@ -1,2 +1,3 @@
 result
 ok
+foo,,bar
index 450892a5c533924e5fcce7f57a819a255164df9f..4fb004d72e6077315323e4a24ca528db1dd1741d 100644 (file)
@@ -741,6 +741,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    915,
 /**/
     914,
 /**/