]> granicus.if.org Git - vim/commitdiff
updated for version 7.3.014 v7.3.014
authorBram Moolenaar <Bram@vim.org>
Wed, 29 Sep 2010 13:50:30 +0000 (15:50 +0200)
committerBram Moolenaar <Bram@vim.org>
Wed, 29 Sep 2010 13:50:30 +0000 (15:50 +0200)
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.

src/ex_getln.c
src/version.c

index 396f686bf02ecc9d41c7cb256709f23cf25788f5..6fa5531d01629e1cbf7f3e1afc679d660f7a4312 100644 (file)
@@ -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;
+           }
        }
     }
 
index 7f6aa67eb5c500bddb79e728dcebdc32d9e02841..ad47acc51bc6f49fba7ceb3b4578d354ce424b01 100644 (file)
@@ -714,6 +714,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    14,
 /**/
     13,
 /**/