updated for version 7.4.662
Problem: When 'M' is in the 'cpo' option then selecting a text object in
parenthesis does not work correctly.
Solution: Keep 'M' in 'cpo' when finding a match. (Hirohito Higashi)
diff --git a/src/search.c b/src/search.c
index 8beacbb..7022870 100644
--- a/src/search.c
+++ b/src/search.c
@@ -3583,10 +3583,11 @@
/*
* Search backwards for unclosed '(', '{', etc..
* Put this position in start_pos.
- * Ignore quotes here.
+ * Ignore quotes here. Keep the "M" flag in 'cpo', as that is what the
+ * user wants.
*/
save_cpo = p_cpo;
- p_cpo = (char_u *)"%";
+ p_cpo = (char_u *)(vim_strchr(p_cpo, CPO_MATCHBSL) != NULL ? "%M" : "%");
while (count-- > 0)
{
if ((pos = findmatch(NULL, what)) == NULL)
diff --git a/src/testdir/Make_amiga.mak b/src/testdir/Make_amiga.mak
index 2567d52..cc4af89 100644
--- a/src/testdir/Make_amiga.mak
+++ b/src/testdir/Make_amiga.mak
@@ -53,6 +53,7 @@
test_options.out \
test_qf_title.out \
test_signs.out \
+ test_textobjects.out \
test_utf8.out
.SUFFIXES: .in .out
@@ -194,4 +195,5 @@
test_options.out: test_options.in
test_qf_title.out: test_qf_title.in
test_signs.out: test_signs.in
+test_textobjects.out: test_textobjects.in
test_utf8.out: test_utf8.in
diff --git a/src/testdir/Make_dos.mak b/src/testdir/Make_dos.mak
index 4b17f96..fcd81b5 100644
--- a/src/testdir/Make_dos.mak
+++ b/src/testdir/Make_dos.mak
@@ -52,6 +52,7 @@
test_options.out \
test_qf_title.out \
test_signs.out \
+ test_textobjects.out \
test_utf8.out
SCRIPTS32 = test50.out test70.out
diff --git a/src/testdir/Make_ming.mak b/src/testdir/Make_ming.mak
index a907fb1..3e6a50f 100644
--- a/src/testdir/Make_ming.mak
+++ b/src/testdir/Make_ming.mak
@@ -74,6 +74,7 @@
test_options.out \
test_qf_title.out \
test_signs.out \
+ test_textobjects.out \
test_utf8.out
SCRIPTS32 = test50.out test70.out
diff --git a/src/testdir/Make_os2.mak b/src/testdir/Make_os2.mak
index bab000d..31023ea 100644
--- a/src/testdir/Make_os2.mak
+++ b/src/testdir/Make_os2.mak
@@ -54,6 +54,7 @@
test_options.out \
test_qf_title.out \
test_signs.out \
+ test_textobjects.out \
test_utf8.out
SCRIPTS_BENCH = bench_re_freeze.out
diff --git a/src/testdir/Make_vms.mms b/src/testdir/Make_vms.mms
index ab1e529..7448d72 100644
--- a/src/testdir/Make_vms.mms
+++ b/src/testdir/Make_vms.mms
@@ -4,7 +4,7 @@
# Authors: Zoltan Arpadffy, <arpadffy@polarhome.com>
# Sandor Kopanyi, <sandor.kopanyi@mailbox.hu>
#
-# Last change: 2014 Dec 13
+# Last change: 2015 Mar 13
#
# This has been tested on VMS 6.2 to 8.3 on DEC Alpha, VAX and IA64.
# Edit the lines in the Configuration section below to select.
@@ -113,6 +113,7 @@
test_options.out \
test_qf_title.out \
test_signs.out \
+ test_textobjects.out \
test_utf8.out
# Known problems:
diff --git a/src/testdir/Makefile b/src/testdir/Makefile
index 626c81e..9661836 100644
--- a/src/testdir/Makefile
+++ b/src/testdir/Makefile
@@ -50,6 +50,7 @@
test_options.out \
test_qf_title.out \
test_signs.out \
+ test_textobjects.out \
test_utf8.out
SCRIPTS_GUI = test16.out
diff --git a/src/testdir/test_textobjects.in b/src/testdir/test_textobjects.in
new file mode 100644
index 0000000..d1cdafc
--- /dev/null
+++ b/src/testdir/test_textobjects.in
@@ -0,0 +1,40 @@
+Tests for text-objects vim: set ft=vim :
+
+STARTTEST
+:so small.vim
+:if !has('textobjects') | e! test.ok | wq! test.out | endif
+:set nocompatible
+:"
+:function SelectionOut(data)
+: new
+: call setline(1, a:data)
+: call setreg('"', '')
+: normal! ggfrmavi)y
+: $put =getreg('\"')
+: call setreg('"', '')
+: normal! `afbmavi)y
+: $put =getreg('\"')
+: call setreg('"', '')
+: normal! `afgmavi)y
+: $put =getreg('\"')
+: %yank a
+: q!
+: $put =getreg('a')
+:endfunction
+:"
+:$put ='# Test for vi) without cpo-M'
+:set cpo-=M
+:call SelectionOut('(red \(blue) green)')
+:"
+:$put ='# Test for vi) with cpo-M #1'
+:set cpo+=M
+:call SelectionOut('(red \(blue) green)')
+:"
+:$put ='# Test for vi) with cpo-M #2'
+:set cpo+=M
+:call SelectionOut('(red (blue\) green)')
+:/^Results/,$w test.out
+:qa!
+ENDTEST
+
+Results of text-objects
diff --git a/src/testdir/test_textobjects.ok b/src/testdir/test_textobjects.ok
new file mode 100644
index 0000000..b670c7d
--- /dev/null
+++ b/src/testdir/test_textobjects.ok
@@ -0,0 +1,16 @@
+Results of text-objects
+# Test for vi) without cpo-M
+(red \(blue) green)
+red \(blue
+red \(blue
+
+# Test for vi) with cpo-M #1
+(red \(blue) green)
+red \(blue) green
+blue
+red \(blue) green
+# Test for vi) with cpo-M #2
+(red (blue\) green)
+red (blue\) green
+blue\
+red (blue\) green
diff --git a/src/version.c b/src/version.c
index e523a41..5bb8a4c 100644
--- a/src/version.c
+++ b/src/version.c
@@ -742,6 +742,8 @@
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 662,
+/**/
661,
/**/
660,