summaryrefslogtreecommitdiff
path: root/source/ap/vim/patches/7.4.045
diff options
context:
space:
mode:
Diffstat (limited to 'source/ap/vim/patches/7.4.045')
-rw-r--r--source/ap/vim/patches/7.4.045111
1 files changed, 111 insertions, 0 deletions
diff --git a/source/ap/vim/patches/7.4.045 b/source/ap/vim/patches/7.4.045
new file mode 100644
index 00000000..0e82735a
--- /dev/null
+++ b/source/ap/vim/patches/7.4.045
@@ -0,0 +1,111 @@
+To: vim_dev@googlegroups.com
+Subject: Patch 7.4.045
+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.045
+Problem: substitute() does not work properly when the pattern starts with
+ "\ze".
+Solution: Detect an empty match. (Christian Brabandt)
+Files: src/eval.c, src/testdir/test80.in, src/testdir/test80.ok
+
+
+*** ../vim-7.4.044/src/eval.c 2013-09-25 21:00:24.000000000 +0200
+--- src/eval.c 2013-09-29 21:03:22.000000000 +0200
+***************
+*** 24301,24306 ****
+--- 24301,24307 ----
+ 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;
+***************
+*** 24339,24358 ****
+ (void)vim_regsub(&regmatch, sub, (char_u *)ga.ga_data
+ + ga.ga_len + i, TRUE, TRUE, FALSE);
+ ga.ga_len += i + sublen - 1;
+! /* avoid getting stuck on a match with an empty string */
+! if (tail == regmatch.endp[0])
+ {
+! if (*tail == NUL)
+! break;
+ *((char_u *)ga.ga_data + ga.ga_len) = *tail++;
+ ++ga.ga_len;
+ }
+- else
+- {
+- tail = regmatch.endp[0];
+- if (*tail == NUL)
+- break;
+- }
+ if (!do_all)
+ break;
+ }
+--- 24340,24356 ----
+ (void)vim_regsub(&regmatch, 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;
+ }
+*** ../vim-7.4.044/src/testdir/test80.in 2013-03-19 17:30:51.000000000 +0100
+--- src/testdir/test80.in 2013-09-29 20:59:00.000000000 +0200
+***************
+*** 142,147 ****
+--- 142,149 ----
+ :$put =\"\n\nTEST_7:\"
+ :$put =substitute('A A', 'A.', '\=submatch(0)', '')
+ :$put =substitute(\"B\nB\", 'B.', '\=submatch(0)', '')
++ :$put =substitute('-bb', '\zeb', 'a', 'g')
++ :$put =substitute('-bb', '\ze', 'c', 'g')
+ /^TEST_8
+ ENDTEST
+
+*** ../vim-7.4.044/src/testdir/test80.ok 2013-03-19 17:31:45.000000000 +0100
+--- src/testdir/test80.ok 2013-09-29 20:59:35.000000000 +0200
+***************
+*** 103,108 ****
+--- 103,110 ----
+ A A
+ B
+ B
++ -abab
++ c-cbcbc
+
+
+ TEST_8:
+*** ../vim-7.4.044/src/version.c 2013-09-29 19:05:17.000000000 +0200
+--- src/version.c 2013-09-29 21:04:50.000000000 +0200
+***************
+*** 740,741 ****
+--- 740,743 ----
+ { /* Add new patch number below this line */
++ /**/
++ 45,
+ /**/
+
+--
+Just think of all the things we haven't thought of yet.
+
+ /// 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 ///