summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-01-01 14:48:20 +0100
committerBram Moolenaar <Bram@vim.org>2016-01-01 14:48:20 +0100
commit8f79acdf7ede2693fbda53c3c9693f16db4f193b (patch)
treeb897f76e3c986698541a575f74034c0ae358d853
parent8dfc5eb32818b11ff5818a060324b94345c40031 (diff)
downloadvim-git-8f79acdf7ede2693fbda53c3c9693f16db4f193b.tar.gz
patch 7.4.1017v7.4.1017
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.
-rw-r--r--src/Makefile2
-rw-r--r--src/option.c12
-rw-r--r--src/testdir/test_alot.vim1
-rw-r--r--src/testdir/test_cdo.vim1
-rw-r--r--src/testdir/test_set.in12
-rw-r--r--src/testdir/test_set.ok1
-rw-r--r--src/testdir/test_set.vim27
-rw-r--r--src/version.c2
8 files changed, 40 insertions, 18 deletions
diff --git a/src/Makefile b/src/Makefile
index e3b8c9fcc..f0bfbb578 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -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 \
diff --git a/src/option.c b/src/option.c
index c7ef6ee3c..aca0f315f 100644
--- a/src/option.c
+++ b/src/option.c
@@ -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;
diff --git a/src/testdir/test_alot.vim b/src/testdir/test_alot.vim
index f15a2dce2..b1e2ed834 100644
--- a/src/testdir/test_alot.vim
+++ b/src/testdir/test_alot.vim
@@ -3,5 +3,6 @@
source test_lispwords.vim
source test_searchpos.vim
+source test_set.vim
source test_sort.vim
source test_undolevels.vim
diff --git a/src/testdir/test_cdo.vim b/src/testdir/test_cdo.vim
index 10cd97c31..988de1dd2 100644
--- a/src/testdir/test_cdo.vim
+++ b/src/testdir/test_cdo.vim
@@ -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
index 5528ee6e3..000000000
--- a/src/testdir/test_set.in
+++ /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
index 5d6a70872..000000000
--- a/src/testdir/test_set.ok
+++ /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
index 000000000..b98046384
--- /dev/null
+++ b/src/testdir/test_set.vim
@@ -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
diff --git a/src/version.c b/src/version.c
index b491c4846..dfb6ad10f 100644
--- a/src/version.c
+++ b/src/version.c
@@ -742,6 +742,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1017,
+/**/
1016,
/**/
1015,