Karsten Hopp 95da14
To: vim-dev@vim.org
Karsten Hopp 95da14
Subject: Patch 7.3.014
Karsten Hopp 95da14
Fcc: outbox
Karsten Hopp 95da14
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 95da14
Mime-Version: 1.0
Karsten Hopp 95da14
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 95da14
Content-Transfer-Encoding: 8bit
Karsten Hopp 95da14
------------
Karsten Hopp 95da14
Karsten Hopp 95da14
Patch 7.3.014
Karsten Hopp 95da14
Problem:    Ending a line in a backslash inside an ":append" or ":insert" 
Karsten Hopp 95da14
            command in Ex mode doesn't work properly. (Ray Frush)
Karsten Hopp 95da14
Solution:   Halve the number of backslashes, only insert a NUL after an odd 
Karsten Hopp 95da14
            number of backslashes.
Karsten Hopp 95da14
Files:      src/ex_getln.c
Karsten Hopp 95da14
Karsten Hopp 95da14
Karsten Hopp 95da14
*** ../vim-7.3.013/src/ex_getln.c	2010-09-21 16:56:29.000000000 +0200
Karsten Hopp 95da14
--- src/ex_getln.c	2010-09-29 15:47:56.000000000 +0200
Karsten Hopp 95da14
***************
Karsten Hopp 95da14
*** 2342,2356 ****
Karsten Hopp 95da14
  	windgoto(msg_row, msg_col);
Karsten Hopp 95da14
  	pend = (char_u *)(line_ga.ga_data) + line_ga.ga_len;
Karsten Hopp 95da14
  
Karsten Hopp 95da14
! 	/* we are done when a NL is entered, but not when it comes after a
Karsten Hopp 95da14
! 	 * backslash */
Karsten Hopp 95da14
! 	if (line_ga.ga_len > 0 && pend[-1] == '\n'
Karsten Hopp 95da14
! 		&& (line_ga.ga_len <= 1 || pend[-2] != '\\'))
Karsten Hopp 95da14
! 	{
Karsten Hopp 95da14
! 	    --line_ga.ga_len;
Karsten Hopp 95da14
! 	    --pend;
Karsten Hopp 95da14
! 	    *pend = NUL;
Karsten Hopp 95da14
! 	    break;
Karsten Hopp 95da14
  	}
Karsten Hopp 95da14
      }
Karsten Hopp 95da14
  
Karsten Hopp 95da14
--- 2342,2372 ----
Karsten Hopp 95da14
  	windgoto(msg_row, msg_col);
Karsten Hopp 95da14
  	pend = (char_u *)(line_ga.ga_data) + line_ga.ga_len;
Karsten Hopp 95da14
  
Karsten Hopp 95da14
! 	/* We are done when a NL is entered, but not when it comes after an
Karsten Hopp 95da14
! 	 * odd number of backslashes, that results in a NUL. */
Karsten Hopp 95da14
! 	if (line_ga.ga_len > 0 && pend[-1] == '\n')
Karsten Hopp 95da14
! 	{
Karsten Hopp 95da14
! 	    int bcount = 0;
Karsten Hopp 95da14
! 
Karsten Hopp 95da14
! 	    while (line_ga.ga_len - 2 >= bcount && pend[-2 - bcount] == '\\')
Karsten Hopp 95da14
! 		++bcount;
Karsten Hopp 95da14
! 
Karsten Hopp 95da14
! 	    if (bcount > 0)
Karsten Hopp 95da14
! 	    {
Karsten Hopp 95da14
! 		/* Halve the number of backslashes: "\NL" -> "NUL", "\\NL" ->
Karsten Hopp 95da14
! 		 * "\NL", etc. */
Karsten Hopp 95da14
! 		line_ga.ga_len -= (bcount + 1) / 2;
Karsten Hopp 95da14
! 		pend -= (bcount + 1) / 2;
Karsten Hopp 95da14
! 		pend[-1] = '\n';
Karsten Hopp 95da14
! 	    }
Karsten Hopp 95da14
! 
Karsten Hopp 95da14
! 	    if ((bcount & 1) == 0)
Karsten Hopp 95da14
! 	    {
Karsten Hopp 95da14
! 		--line_ga.ga_len;
Karsten Hopp 95da14
! 		--pend;
Karsten Hopp 95da14
! 		*pend = NUL;
Karsten Hopp 95da14
! 		break;
Karsten Hopp 95da14
! 	    }
Karsten Hopp 95da14
  	}
Karsten Hopp 95da14
      }
Karsten Hopp 95da14
  
Karsten Hopp 95da14
*** ../vim-7.3.013/src/version.c	2010-09-29 13:02:48.000000000 +0200
Karsten Hopp 95da14
--- src/version.c	2010-09-29 15:45:57.000000000 +0200
Karsten Hopp 95da14
***************
Karsten Hopp 95da14
*** 716,717 ****
Karsten Hopp 95da14
--- 716,719 ----
Karsten Hopp 95da14
  {   /* Add new patch number below this line */
Karsten Hopp 95da14
+ /**/
Karsten Hopp 95da14
+     14,
Karsten Hopp 95da14
  /**/
Karsten Hopp 95da14
Karsten Hopp 95da14
-- 
Karsten Hopp 95da14
hundred-and-one symptoms of being an internet addict:
Karsten Hopp 95da14
224. You set up your own Web page. You set up a Web page for each
Karsten Hopp 95da14
     of your kids... and your pets.
Karsten Hopp 95da14
Karsten Hopp 95da14
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 95da14
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 95da14
\\\        download, build and distribute -- http://www.A-A-P.org        ///
Karsten Hopp 95da14
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///