summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2010-09-29 15:50:30 +0200
committerBram Moolenaar <Bram@vim.org>2010-09-29 15:50:30 +0200
commit417f5e7f1173d63e9dcb77c4b80cb6bb317336c8 (patch)
tree8913e3b31fc7f05a6cbb563a73b022c553ec39af
parentf9b5ef8c881be98f8d463f16c6a8db4ddb6a8f83 (diff)
downloadvim-417f5e7f1173d63e9dcb77c4b80cb6bb317336c8.zip
updated for version 7.3.014
Problem: Ending a line in a backslash inside an ":append" or ":insert" command in Ex mode doesn't work properly. (Ray Frush) Solution: Halve the number of backslashes, only insert a NUL after an odd number of backslashes.
-rw-r--r--src/ex_getln.c32
-rw-r--r--src/version.c2
2 files changed, 26 insertions, 8 deletions
diff --git a/src/ex_getln.c b/src/ex_getln.c
index 396f686bf..6fa5531d0 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -2342,15 +2342,31 @@ redraw:
windgoto(msg_row, msg_col);
pend = (char_u *)(line_ga.ga_data) + line_ga.ga_len;
- /* we are done when a NL is entered, but not when it comes after a
- * backslash */
- if (line_ga.ga_len > 0 && pend[-1] == '\n'
- && (line_ga.ga_len <= 1 || pend[-2] != '\\'))
+ /* We are done when a NL is entered, but not when it comes after an
+ * odd number of backslashes, that results in a NUL. */
+ if (line_ga.ga_len > 0 && pend[-1] == '\n')
{
- --line_ga.ga_len;
- --pend;
- *pend = NUL;
- break;
+ int bcount = 0;
+
+ while (line_ga.ga_len - 2 >= bcount && pend[-2 - bcount] == '\\')
+ ++bcount;
+
+ if (bcount > 0)
+ {
+ /* Halve the number of backslashes: "\NL" -> "NUL", "\\NL" ->
+ * "\NL", etc. */
+ line_ga.ga_len -= (bcount + 1) / 2;
+ pend -= (bcount + 1) / 2;
+ pend[-1] = '\n';
+ }
+
+ if ((bcount & 1) == 0)
+ {
+ --line_ga.ga_len;
+ --pend;
+ *pend = NUL;
+ break;
+ }
}
}
diff --git a/src/version.c b/src/version.c
index 7f6aa67eb..ad47acc51 100644
--- a/src/version.c
+++ b/src/version.c
@@ -715,6 +715,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 14,
+/**/
13,
/**/
12,