Karsten Hopp 9366dd
To: vim-dev@vim.org
Karsten Hopp 9366dd
Subject: Patch 7.0.126
Karsten Hopp 9366dd
Fcc: outbox
Karsten Hopp 9366dd
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 9366dd
Mime-Version: 1.0
Karsten Hopp 9366dd
Content-Type: text/plain; charset=ISO-8859-1
Karsten Hopp 9366dd
Content-Transfer-Encoding: 8bit
Karsten Hopp 9366dd
------------
Karsten Hopp 9366dd
Karsten Hopp 9366dd
Patch 7.0.126
Karsten Hopp 9366dd
Problem:    When 'formatexpr' uses setline() and later internal formatting is
Karsten Hopp 9366dd
	    used undo information is not correct. (Jiri Cerny, Benji Fisher)
Karsten Hopp 9366dd
Solution:   Set ins_need_undo after using 'formatexpr'.
Karsten Hopp 9366dd
Files:	    src/edit.c
Karsten Hopp 9366dd
Karsten Hopp 9366dd
Karsten Hopp 9366dd
*** ../vim-7.0.125/src/edit.c	Fri Oct  6 20:39:58 2006
Karsten Hopp 9366dd
--- src/edit.c	Tue Oct 10 12:46:04 2006
Karsten Hopp 9366dd
***************
Karsten Hopp 9366dd
*** 5333,5340 ****
Karsten Hopp 9366dd
  	/* Format with 'formatexpr' when it's set.  Use internal formatting
Karsten Hopp 9366dd
  	 * when 'formatexpr' isn't set or it returns non-zero. */
Karsten Hopp 9366dd
  #if defined(FEAT_EVAL)
Karsten Hopp 9366dd
! 	if (*curbuf->b_p_fex == NUL
Karsten Hopp 9366dd
! 			     || fex_format(curwin->w_cursor.lnum, 1L, c) != 0)
Karsten Hopp 9366dd
  #endif
Karsten Hopp 9366dd
  	    internal_format(textwidth, second_indent, flags, c == NUL);
Karsten Hopp 9366dd
      }
Karsten Hopp 9366dd
--- 5333,5348 ----
Karsten Hopp 9366dd
  	/* Format with 'formatexpr' when it's set.  Use internal formatting
Karsten Hopp 9366dd
  	 * when 'formatexpr' isn't set or it returns non-zero. */
Karsten Hopp 9366dd
  #if defined(FEAT_EVAL)
Karsten Hopp 9366dd
! 	int do_internal = TRUE;
Karsten Hopp 9366dd
! 
Karsten Hopp 9366dd
! 	if (*curbuf->b_p_fex != NUL)
Karsten Hopp 9366dd
! 	{
Karsten Hopp 9366dd
! 	    do_internal = (fex_format(curwin->w_cursor.lnum, 1L, c) != 0);
Karsten Hopp 9366dd
! 	    /* It may be required to save for undo again, e.g. when setline()
Karsten Hopp 9366dd
! 	     * was called. */
Karsten Hopp 9366dd
! 	    ins_need_undo = TRUE;
Karsten Hopp 9366dd
! 	}
Karsten Hopp 9366dd
! 	if (do_internal)
Karsten Hopp 9366dd
  #endif
Karsten Hopp 9366dd
  	    internal_format(textwidth, second_indent, flags, c == NUL);
Karsten Hopp 9366dd
      }
Karsten Hopp 9366dd
*** ../vim-7.0.125/src/version.c	Tue Oct 10 13:27:30 2006
Karsten Hopp 9366dd
--- src/version.c	Tue Oct 10 15:47:20 2006
Karsten Hopp 9366dd
***************
Karsten Hopp 9366dd
*** 668,669 ****
Karsten Hopp 9366dd
--- 668,671 ----
Karsten Hopp 9366dd
  {   /* Add new patch number below this line */
Karsten Hopp 9366dd
+ /**/
Karsten Hopp 9366dd
+     126,
Karsten Hopp 9366dd
  /**/
Karsten Hopp 9366dd
Karsten Hopp 9366dd
-- 
Karsten Hopp 9366dd
How To Keep A Healthy Level Of Insanity:
Karsten Hopp 9366dd
16. Have your coworkers address you by your wrestling name, Rock Hard Kim.
Karsten Hopp 9366dd
Karsten Hopp 9366dd
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 9366dd
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 9366dd
\\\        download, build and distribute -- http://www.A-A-P.org        ///
Karsten Hopp 9366dd
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///