- patchlevel 158
This commit is contained in:
parent
9c6a936735
commit
d44f374691
140
7.4.158
Normal file
140
7.4.158
Normal file
@ -0,0 +1,140 @@
|
||||
To: vim_dev@googlegroups.com
|
||||
Subject: Patch 7.4.158
|
||||
Fcc: outbox
|
||||
From: Bram Moolenaar <Bram@moolenaar.net>
|
||||
Mime-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
------------
|
||||
|
||||
Patch 7.4.158 (after 7.4.045)
|
||||
Problem: Pattern containing \zs is not handled correctly by substitute().
|
||||
Solution: Change how an empty match is skipped. (Yukihiro Nakadaira)
|
||||
Files: src/eval.c, src/testdir/test80.in, src/testdir/test80.ok
|
||||
|
||||
|
||||
*** ../vim-7.4.157/src/eval.c 2014-01-14 19:44:30.000000000 +0100
|
||||
--- src/eval.c 2014-01-23 19:25:23.199796533 +0100
|
||||
***************
|
||||
*** 24365,24371 ****
|
||||
garray_T ga;
|
||||
char_u *ret;
|
||||
char_u *save_cpo;
|
||||
! int zero_width;
|
||||
|
||||
/* Make 'cpoptions' empty, so that the 'l' flag doesn't work here */
|
||||
save_cpo = p_cpo;
|
||||
--- 24365,24371 ----
|
||||
garray_T ga;
|
||||
char_u *ret;
|
||||
char_u *save_cpo;
|
||||
! char_u *zero_width = NULL;
|
||||
|
||||
/* Make 'cpoptions' empty, so that the 'l' flag doesn't work here */
|
||||
save_cpo = p_cpo;
|
||||
***************
|
||||
*** 24382,24387 ****
|
||||
--- 24382,24400 ----
|
||||
tail = str;
|
||||
while (vim_regexec_nl(®match, str, (colnr_T)(tail - str)))
|
||||
{
|
||||
+ /* Skip empty match except for first match. */
|
||||
+ if (regmatch.startp[0] == regmatch.endp[0])
|
||||
+ {
|
||||
+ if (zero_width == regmatch.startp[0])
|
||||
+ {
|
||||
+ /* avoid getting stuck on a match with an empty string */
|
||||
+ *((char_u *)ga.ga_data + ga.ga_len) = *tail++;
|
||||
+ ++ga.ga_len;
|
||||
+ continue;
|
||||
+ }
|
||||
+ zero_width = regmatch.startp[0];
|
||||
+ }
|
||||
+
|
||||
/*
|
||||
* Get some space for a temporary buffer to do the substitution
|
||||
* into. It will contain:
|
||||
***************
|
||||
*** 24404,24420 ****
|
||||
(void)vim_regsub(®match, sub, (char_u *)ga.ga_data
|
||||
+ ga.ga_len + i, TRUE, TRUE, FALSE);
|
||||
ga.ga_len += i + sublen - 1;
|
||||
- zero_width = (tail == regmatch.endp[0]
|
||||
- || regmatch.startp[0] == regmatch.endp[0]);
|
||||
tail = regmatch.endp[0];
|
||||
if (*tail == NUL)
|
||||
break;
|
||||
- if (zero_width)
|
||||
- {
|
||||
- /* avoid getting stuck on a match with an empty string */
|
||||
- *((char_u *)ga.ga_data + ga.ga_len) = *tail++;
|
||||
- ++ga.ga_len;
|
||||
- }
|
||||
if (!do_all)
|
||||
break;
|
||||
}
|
||||
--- 24417,24425 ----
|
||||
*** ../vim-7.4.157/src/testdir/test80.in 2013-09-29 21:11:00.000000000 +0200
|
||||
--- src/testdir/test80.in 2014-01-23 19:24:30.487795084 +0100
|
||||
***************
|
||||
*** 176,181 ****
|
||||
--- 176,198 ----
|
||||
TEST_10:
|
||||
|
||||
STARTTEST
|
||||
+ :set magic&
|
||||
+ :set cpo&
|
||||
+ :$put =\"\n\nTEST_10:\"
|
||||
+ :let y = substitute('123', '\zs', 'a', 'g') | $put =y
|
||||
+ :let y = substitute('123', '\zs.', 'a', 'g') | $put =y
|
||||
+ :let y = substitute('123', '.\zs', 'a', 'g') | $put =y
|
||||
+ :let y = substitute('123', '\ze', 'a', 'g') | $put =y
|
||||
+ :let y = substitute('123', '\ze.', 'a', 'g') | $put =y
|
||||
+ :let y = substitute('123', '.\ze', 'a', 'g') | $put =y
|
||||
+ :let y = substitute('123', '1\|\ze', 'a', 'g') | $put =y
|
||||
+ :let y = substitute('123', '1\zs\|[23]', 'a', 'g') | $put =y
|
||||
+ /^TEST_11
|
||||
+ ENDTEST
|
||||
+
|
||||
+ TEST_11:
|
||||
+
|
||||
+ STARTTEST
|
||||
:/^Results/,$wq! test.out
|
||||
ENDTEST
|
||||
|
||||
*** ../vim-7.4.157/src/testdir/test80.ok 2013-09-29 21:11:00.000000000 +0200
|
||||
--- src/testdir/test80.ok 2014-01-23 19:24:35.691795227 +0100
|
||||
***************
|
||||
*** 115,117 ****
|
||||
--- 115,128 ----
|
||||
|
||||
TEST_9:
|
||||
XXx
|
||||
+
|
||||
+
|
||||
+ TEST_10:
|
||||
+ a1a2a3a
|
||||
+ aaa
|
||||
+ 1a2a3a
|
||||
+ a1a2a3a
|
||||
+ a1a2a3
|
||||
+ aaa
|
||||
+ aa2a3a
|
||||
+ 1aaa
|
||||
*** ../vim-7.4.157/src/version.c 2014-01-23 18:12:44.695676751 +0100
|
||||
--- src/version.c 2014-01-23 19:27:21.611799787 +0100
|
||||
***************
|
||||
*** 740,741 ****
|
||||
--- 740,743 ----
|
||||
{ /* Add new patch number below this line */
|
||||
+ /**/
|
||||
+ 158,
|
||||
/**/
|
||||
|
||||
--
|
||||
$ echo pizza > /dev/oven
|
||||
|
||||
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
||||
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
||||
\\\ an exciting new programming language -- http://www.Zimbu.org ///
|
||||
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|
Loading…
Reference in New Issue
Block a user