Hi Bram and list,
How to reproduce:
$ cat test.txt
(red \(blue) green)
$ vim -N -u NONE -c "set cpo+=M" test.txt
0
/re
vi) " 'red \(blue) green' selected --> OK.
v0
/blue
vi) " 'red \(blue) green' selected --> NG. It should selected 'blue'
v0
/green
vi) " Not selected anything --> NG. It should selected 'red \(blue)
green'
I wrote a patch and test.
Please check this.
Best regards, Hirohito Higashi
(a.k.a h_east)
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.
diff -r a82c9509dbce src/search.c
--- a/src/search.c Fri Mar 06 22:00:12 2015 +0100
+++ b/src/search.c Mon Mar 09 00:46:26 2015 +0900
@@ -3586,7 +3586,7 @@
* Ignore quotes here.
*/
save_cpo = p_cpo;
- p_cpo = (char_u *)"%";
+ p_cpo = (char_u *)(vim_strchr(save_cpo, CPO_MATCHBSL) != NULL ? "%M" : "%");
while (count-- > 0)
{
if ((pos = findmatch(NULL, what)) == NULL)
diff -r a82c9509dbce src/testdir/Make_amiga.mak
--- a/src/testdir/Make_amiga.mak Fri Mar 06 22:00:12 2015 +0100
+++ b/src/testdir/Make_amiga.mak Mon Mar 09 00:46:26 2015 +0900
@@ -53,7 +53,8 @@
test_options.out \
test_qf_title.out \
test_signs.out \
- test_utf8.out
+ test_utf8.out \
+ test_textobjects.out
.SUFFIXES: .in .out
@@ -195,3 +196,4 @@
test_qf_title.out: test_qf_title.in
test_signs.out: test_signs.in
test_utf8.out: test_utf8.in
+test_textobjects.out: test_textobjects.in
diff -r a82c9509dbce src/testdir/Make_dos.mak
--- a/src/testdir/Make_dos.mak Fri Mar 06 22:00:12 2015 +0100
+++ b/src/testdir/Make_dos.mak Mon Mar 09 00:46:26 2015 +0900
@@ -52,7 +52,8 @@
test_options.out \
test_qf_title.out \
test_signs.out \
- test_utf8.out
+ test_utf8.out \
+ test_textobjects.out
SCRIPTS32 = test50.out test70.out
diff -r a82c9509dbce src/testdir/Make_ming.mak
--- a/src/testdir/Make_ming.mak Fri Mar 06 22:00:12 2015 +0100
+++ b/src/testdir/Make_ming.mak Mon Mar 09 00:46:26 2015 +0900
@@ -74,7 +74,8 @@
test_options.out \
test_qf_title.out \
test_signs.out \
- test_utf8.out
+ test_utf8.out \
+ test_textobjects.out
SCRIPTS32 = test50.out test70.out
diff -r a82c9509dbce src/testdir/Make_os2.mak
--- a/src/testdir/Make_os2.mak Fri Mar 06 22:00:12 2015 +0100
+++ b/src/testdir/Make_os2.mak Mon Mar 09 00:46:26 2015 +0900
@@ -54,7 +54,8 @@
test_options.out \
test_qf_title.out \
test_signs.out \
- test_utf8.out
+ test_utf8.out \
+ test_textobjects.out
SCRIPTS_BENCH = bench_re_freeze.out
diff -r a82c9509dbce src/testdir/Make_vms.mms
--- a/src/testdir/Make_vms.mms Fri Mar 06 22:00:12 2015 +0100
+++ b/src/testdir/Make_vms.mms Mon Mar 09 00:46:26 2015 +0900
@@ -113,7 +113,8 @@
test_options.out \
test_qf_title.out \
test_signs.out \
- test_utf8.out
+ test_utf8.out \
+ test_textobjects.out
# Known problems:
# test17: ?
diff -r a82c9509dbce src/testdir/Makefile
--- a/src/testdir/Makefile Fri Mar 06 22:00:12 2015 +0100
+++ b/src/testdir/Makefile Mon Mar 09 00:46:26 2015 +0900
@@ -50,7 +50,8 @@
test_options.out \
test_qf_title.out \
test_signs.out \
- test_utf8.out
+ test_utf8.out \
+ test_textobjects.out
SCRIPTS_GUI = test16.out
diff -r a82c9509dbce src/testdir/test_textobjects.in
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/testdir/test_textobjects.in Mon Mar 09 00:46:26 2015 +0900
@@ -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 -r a82c9509dbce src/testdir/test_textobjects.ok
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/testdir/test_textobjects.ok Mon Mar 09 00:46:26 2015 +0900
@@ -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