updated for version 7.3.225
Problem: Using "\n" in a substitute inside ":s" does not result in a line
break.
Solution: Change behavior inside vim_regexec_nl(). Add tests. (Motoya
Kurotsu)
diff --git a/src/regexp.c b/src/regexp.c
index 57ea736..a09ab61 100644
--- a/src/regexp.c
+++ b/src/regexp.c
@@ -6872,6 +6872,7 @@
static regmmatch_T *submatch_mmatch;
static linenr_T submatch_firstlnum;
static linenr_T submatch_maxline;
+static int submatch_line_lbr;
#endif
#if defined(FEAT_MODIFY_FNAME) || defined(FEAT_EVAL) || defined(PROTO)
@@ -6998,6 +6999,7 @@
submatch_mmatch = reg_mmatch;
submatch_firstlnum = reg_firstlnum;
submatch_maxline = reg_maxline;
+ submatch_line_lbr = reg_line_lbr;
save_reg_win = reg_win;
save_ireg_ic = ireg_ic;
can_f_submatch = TRUE;
@@ -7009,9 +7011,10 @@
for (s = eval_result; *s != NUL; mb_ptr_adv(s))
{
- /* Change NL to CR, so that it becomes a line break.
+ /* Change NL to CR, so that it becomes a line break,
+ * unless called from vim_regexec_nl().
* Skip over a backslashed character. */
- if (*s == NL)
+ if (*s == NL && !submatch_line_lbr)
*s = CAR;
else if (*s == '\\' && s[1] != NUL)
{
@@ -7020,8 +7023,9 @@
* :s/abc\\\ndef/\="aaa\\\nbbb"/ on text:
* abc\
* def
+ * Not when called from vim_regexec_nl().
*/
- if (*s == NL)
+ if (*s == NL && !submatch_line_lbr)
*s = CAR;
had_backslash = TRUE;
}
@@ -7044,6 +7048,7 @@
reg_mmatch = submatch_mmatch;
reg_firstlnum = submatch_firstlnum;
reg_maxline = submatch_maxline;
+ reg_line_lbr = submatch_line_lbr;
reg_win = save_reg_win;
ireg_ic = save_ireg_ic;
can_f_submatch = FALSE;
diff --git a/src/testdir/Make_amiga.mak b/src/testdir/Make_amiga.mak
index 7eae20c..e9c30c4 100644
--- a/src/testdir/Make_amiga.mak
+++ b/src/testdir/Make_amiga.mak
@@ -28,7 +28,7 @@
test61.out test62.out test63.out test64.out test65.out \
test66.out test67.out test68.out test69.out test70.out \
test71.out test72.out test73.out test74.out test75.out \
- test76.out test77.out test78.out
+ test76.out test77.out test78.out test79.out test80.out
.SUFFIXES: .in .out
@@ -126,3 +126,5 @@
test76.out: test76.in
test77.out: test77.in
test78.out: test78.in
+test79.out: test79.in
+test80.out: test80.in
diff --git a/src/testdir/Make_dos.mak b/src/testdir/Make_dos.mak
index 3c221d0..e6b5ff2 100644
--- a/src/testdir/Make_dos.mak
+++ b/src/testdir/Make_dos.mak
@@ -28,7 +28,8 @@
test37.out test38.out test39.out test40.out test41.out \
test42.out test52.out test65.out test66.out test67.out \
test68.out test69.out test71.out test72.out test73.out \
- test74.out test75.out test76.out test77.out test78.out
+ test74.out test75.out test76.out test77.out test78.out \
+ test79.out test80.out
SCRIPTS32 = test50.out test70.out
diff --git a/src/testdir/Make_ming.mak b/src/testdir/Make_ming.mak
index 1735062..e752825 100644
--- a/src/testdir/Make_ming.mak
+++ b/src/testdir/Make_ming.mak
@@ -48,7 +48,8 @@
test37.out test38.out test39.out test40.out test41.out \
test42.out test52.out test65.out test66.out test67.out \
test68.out test69.out test71.out test72.out test73.out \
- test74.out test75.out test76.out test77.out test78.out
+ test74.out test75.out test76.out test77.out test78.out \
+ test79.out test80.out
SCRIPTS32 = test50.out test70.out
diff --git a/src/testdir/Make_os2.mak b/src/testdir/Make_os2.mak
index 82e07f4..a80dff5 100644
--- a/src/testdir/Make_os2.mak
+++ b/src/testdir/Make_os2.mak
@@ -28,7 +28,7 @@
test61.out test62.out test63.out test64.out test65.out \
test66.out test67.out test68.out test69.out test70.out \
test71.out test72.out test73.out test74.out test75.out \
- test76.out test77.out test78.out
+ test76.out test77.out test78.out test79.out test80.out
.SUFFIXES: .in .out
diff --git a/src/testdir/Make_vms.mms b/src/testdir/Make_vms.mms
index 7702b98..58ab4e8 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: 2011 Jun 13
+# Last change: 2011 Jun 19
#
# 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.
@@ -75,7 +75,7 @@
test61.out test62.out test63.out test64.out test65.out \
test66.out test67.out test68.out test69.out \
test71.out test72.out test74.out test75.out test76.out \
- test77.out test78.out
+ test77.out test78.out test79.out test80.out
# Known problems:
# Test 30: a problem around mac format - unknown reason
diff --git a/src/testdir/Makefile b/src/testdir/Makefile
index 7a2a09f..8561016 100644
--- a/src/testdir/Makefile
+++ b/src/testdir/Makefile
@@ -25,7 +25,8 @@
test59.out test60.out test61.out test62.out test63.out \
test64.out test65.out test66.out test67.out test68.out \
test69.out test70.out test71.out test72.out test73.out \
- test74.out test75.out test76.out test77.out test78.out
+ test74.out test75.out test76.out test77.out test78.out \
+ test79.out test80.out
SCRIPTS_GUI = test16.out
diff --git a/src/testdir/test79.in b/src/testdir/test79.in
new file mode 100644
index 0000000..8fa11d9
--- /dev/null
+++ b/src/testdir/test79.in
Binary files differ
diff --git a/src/testdir/test79.ok b/src/testdir/test79.ok
new file mode 100644
index 0000000..6685b44
--- /dev/null
+++ b/src/testdir/test79.ok
Binary files differ
diff --git a/src/testdir/test80.in b/src/testdir/test80.in
new file mode 100644
index 0000000..b496500
--- /dev/null
+++ b/src/testdir/test80.in
Binary files differ
diff --git a/src/testdir/test80.ok b/src/testdir/test80.ok
new file mode 100644
index 0000000..fd5b5e7
--- /dev/null
+++ b/src/testdir/test80.ok
Binary files differ
diff --git a/src/version.c b/src/version.c
index a5afd22..f169b56 100644
--- a/src/version.c
+++ b/src/version.c
@@ -710,6 +710,8 @@
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 225,
+/**/
224,
/**/
223,