]> granicus.if.org Git - vim/commitdiff
patch 7.4.1017 v7.4.1017
authorBram Moolenaar <Bram@vim.org>
Fri, 1 Jan 2016 13:48:20 +0000 (14:48 +0100)
committerBram Moolenaar <Bram@vim.org>
Fri, 1 Jan 2016 13:48:20 +0000 (14:48 +0100)
Problem:    When there is a backslash in an option ":set -=" doesn't work.
Solution:   Handle a backslash better. (Jacob Niehus)  Add a new test, merge
            in old test.

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

index e3b8c9fcca8afcbb30a908f31453678fffced326..f0bfbb5787a4d1cc4ab1129db827faeda2b00185 100644 (file)
@@ -1958,7 +1958,6 @@ test1 \
        test_qf_title \
        test_ruby \
        test_search_mbyte \
-       test_set \
        test_signs \
        test_tagcase \
        test_textobjects \
@@ -1980,6 +1979,7 @@ test1 \
 test_assert \
        test_cdo \
        test_searchpos \
+       test_set \
        test_sort \
        test_undolevels \
        test_viml \
index c7ef6ee3cf16d78d7bf244edc6e28f8093264e61..aca0f315fb6692f4c2fc48f65e995644a9ddb6b8 100644 (file)
@@ -4839,9 +4839,15 @@ do_set(arg, opt_flags)
                                                || s[i] == NUL))
                                        break;
                                    /* Count backslashes.  Only a comma with an
-                                    * even number of backslashes before it is
-                                    * recognized as a separator */
-                                   if (s > origval && s[-1] == '\\')
+                                    * even number of backslashes or a single
+                                    * backslash preceded by a comma before it
+                                    * is recognized as a separator */
+                                   if ((s > origval + 1
+                                               && s[-1] == '\\'
+                                               && s[-2] != ',')
+                                           || (s == origval + 1
+                                               && s[-1] == '\\'))
+
                                        ++bs;
                                    else
                                        bs = 0;
index f15a2dce2cebcd9c44157f68b5b045a61d4dde6f..b1e2ed83438ced417d2a7f91a3ca0107754ef376 100644 (file)
@@ -3,5 +3,6 @@
 
 source test_lispwords.vim
 source test_searchpos.vim
+source test_set.vim
 source test_sort.vim
 source test_undolevels.vim
index 10cd97c31ffd7cf94ff6641822342dbf1b977cd0..988de1dd266c4f0cfd06bfb7b714014565e85439 100644 (file)
@@ -1,6 +1,5 @@
 " Tests for the :cdo, :cfdo, :ldo and :lfdo commands
 
-lang mess C
 if !has('quickfix')
   finish
 endif
diff --git a/src/testdir/test_set.in b/src/testdir/test_set.in
deleted file mode 100644 (file)
index 5528ee6..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-Tests for :set     vim: set ft=vim :
-
-STARTTEST
-:so small.vim
-:set wildignore=*.png,
-:set wildignore+=*.jpg
-:$put =&wildignore
-:/^Output goes here/+1,$w! test.out
-:qa!
-ENDTEST
-
-Output goes here
diff --git a/src/testdir/test_set.ok b/src/testdir/test_set.ok
deleted file mode 100644 (file)
index 5d6a708..0000000
+++ /dev/null
@@ -1 +0,0 @@
-*.png,*.jpg
diff --git a/src/testdir/test_set.vim b/src/testdir/test_set.vim
new file mode 100644 (file)
index 0000000..b980463
--- /dev/null
@@ -0,0 +1,27 @@
+" Tests for the :set command
+
+function Test_set_backslash()
+  let isk_save = &isk
+
+  set isk=a,b,c
+  set isk+=d
+  call assert_equal('a,b,c,d', &isk)
+  set isk+=\\,e
+  call assert_equal('a,b,c,d,\,e', &isk)
+  set isk-=e
+  call assert_equal('a,b,c,d,\', &isk)
+  set isk-=\\
+  call assert_equal('a,b,c,d', &isk)
+
+  let &isk = isk_save
+endfunction
+
+function Test_set_add()
+  let wig_save = &wig
+
+  set wildignore=*.png,
+  set wildignore+=*.jpg
+  call assert_equal('*.png,*.jpg', &wig)
+
+  let &wig = wig_save
+endfunction
index b491c48461e04ddd6749226ea60ec0ed2aa64c4c..dfb6ad10f4d77b80ecd029f775a6798ca9f4b9b6 100644 (file)
@@ -741,6 +741,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1017,
 /**/
     1016,
 /**/