forked from aniani/vim
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)
This commit is contained in:
parent
6c5bdb751c
commit
438b64ab71
@ -3583,10 +3583,11 @@ current_block(oap, count, include, what, other)
|
|||||||
/*
|
/*
|
||||||
* Search backwards for unclosed '(', '{', etc..
|
* Search backwards for unclosed '(', '{', etc..
|
||||||
* Put this position in start_pos.
|
* 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;
|
save_cpo = p_cpo;
|
||||||
p_cpo = (char_u *)"%";
|
p_cpo = (char_u *)(vim_strchr(p_cpo, CPO_MATCHBSL) != NULL ? "%M" : "%");
|
||||||
while (count-- > 0)
|
while (count-- > 0)
|
||||||
{
|
{
|
||||||
if ((pos = findmatch(NULL, what)) == NULL)
|
if ((pos = findmatch(NULL, what)) == NULL)
|
||||||
|
@ -53,6 +53,7 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \
|
|||||||
test_options.out \
|
test_options.out \
|
||||||
test_qf_title.out \
|
test_qf_title.out \
|
||||||
test_signs.out \
|
test_signs.out \
|
||||||
|
test_textobjects.out \
|
||||||
test_utf8.out
|
test_utf8.out
|
||||||
|
|
||||||
.SUFFIXES: .in .out
|
.SUFFIXES: .in .out
|
||||||
@ -194,4 +195,5 @@ test_nested_function.out: test_nested_function.in
|
|||||||
test_options.out: test_options.in
|
test_options.out: test_options.in
|
||||||
test_qf_title.out: test_qf_title.in
|
test_qf_title.out: test_qf_title.in
|
||||||
test_signs.out: test_signs.in
|
test_signs.out: test_signs.in
|
||||||
|
test_textobjects.out: test_textobjects.in
|
||||||
test_utf8.out: test_utf8.in
|
test_utf8.out: test_utf8.in
|
||||||
|
@ -52,6 +52,7 @@ SCRIPTS = test3.out test4.out test5.out test6.out test7.out \
|
|||||||
test_options.out \
|
test_options.out \
|
||||||
test_qf_title.out \
|
test_qf_title.out \
|
||||||
test_signs.out \
|
test_signs.out \
|
||||||
|
test_textobjects.out \
|
||||||
test_utf8.out
|
test_utf8.out
|
||||||
|
|
||||||
SCRIPTS32 = test50.out test70.out
|
SCRIPTS32 = test50.out test70.out
|
||||||
|
@ -74,6 +74,7 @@ SCRIPTS = test3.out test4.out test5.out test6.out test7.out \
|
|||||||
test_options.out \
|
test_options.out \
|
||||||
test_qf_title.out \
|
test_qf_title.out \
|
||||||
test_signs.out \
|
test_signs.out \
|
||||||
|
test_textobjects.out \
|
||||||
test_utf8.out
|
test_utf8.out
|
||||||
|
|
||||||
SCRIPTS32 = test50.out test70.out
|
SCRIPTS32 = test50.out test70.out
|
||||||
|
@ -54,6 +54,7 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \
|
|||||||
test_options.out \
|
test_options.out \
|
||||||
test_qf_title.out \
|
test_qf_title.out \
|
||||||
test_signs.out \
|
test_signs.out \
|
||||||
|
test_textobjects.out \
|
||||||
test_utf8.out
|
test_utf8.out
|
||||||
|
|
||||||
SCRIPTS_BENCH = bench_re_freeze.out
|
SCRIPTS_BENCH = bench_re_freeze.out
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
# Authors: Zoltan Arpadffy, <arpadffy@polarhome.com>
|
# Authors: Zoltan Arpadffy, <arpadffy@polarhome.com>
|
||||||
# Sandor Kopanyi, <sandor.kopanyi@mailbox.hu>
|
# 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.
|
# 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.
|
# Edit the lines in the Configuration section below to select.
|
||||||
@ -113,6 +113,7 @@ SCRIPT = test1.out test2.out test3.out test4.out test5.out \
|
|||||||
test_options.out \
|
test_options.out \
|
||||||
test_qf_title.out \
|
test_qf_title.out \
|
||||||
test_signs.out \
|
test_signs.out \
|
||||||
|
test_textobjects.out \
|
||||||
test_utf8.out
|
test_utf8.out
|
||||||
|
|
||||||
# Known problems:
|
# Known problems:
|
||||||
|
@ -50,6 +50,7 @@ SCRIPTS = test1.out test2.out test3.out test4.out test5.out test6.out \
|
|||||||
test_options.out \
|
test_options.out \
|
||||||
test_qf_title.out \
|
test_qf_title.out \
|
||||||
test_signs.out \
|
test_signs.out \
|
||||||
|
test_textobjects.out \
|
||||||
test_utf8.out
|
test_utf8.out
|
||||||
|
|
||||||
SCRIPTS_GUI = test16.out
|
SCRIPTS_GUI = test16.out
|
||||||
|
40
src/testdir/test_textobjects.in
Normal file
40
src/testdir/test_textobjects.in
Normal file
@ -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
|
16
src/testdir/test_textobjects.ok
Normal file
16
src/testdir/test_textobjects.ok
Normal file
@ -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
|
@ -741,6 +741,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
662,
|
||||||
/**/
|
/**/
|
||||||
661,
|
661,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user