Blob Blame History Raw
To: vim-dev@vim.org
Subject: patch 7.0.181
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
------------

Patch 7.0.181
Problem:    When reloading a file that starts with an empty line, the reloaded
	    buffer has an extra empty line at the end. (Motty Lentzitzky)
Solution:   Delete all lines, don't use bufempty().
Files:	    src/fileio.c


*** ../vim-7.0.180/src/fileio.c	Thu Oct 12 21:15:04 2006
--- src/fileio.c	Tue Jan  9 15:38:13 2007
***************
*** 6178,6185 ****
      if (retval != FAIL)
      {
  	curbuf = frombuf;
! 	while (!bufempty())
! 	    if (ml_delete(curbuf->b_ml.ml_line_count, FALSE) == FAIL)
  	    {
  		/* Oops!  We could try putting back the saved lines, but that
  		 * might fail again... */
--- 6179,6186 ----
      if (retval != FAIL)
      {
  	curbuf = frombuf;
! 	for (lnum = curbuf->b_ml.ml_line_count; lnum > 0; --lnum)
! 	    if (ml_delete(lnum, FALSE) == FAIL)
  	    {
  		/* Oops!  We could try putting back the saved lines, but that
  		 * might fail again... */
*** ../vim-7.0.180/src/version.c	Tue Jan  9 15:15:36 2007
--- src/version.c	Tue Jan  9 15:41:55 2007
***************
*** 668,669 ****
--- 668,671 ----
  {   /* Add new patch number below this line */
+ /**/
+     181,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
11. You find yourself typing "com" after every period when using a word
    processor.com

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///