Blob Blame History Raw
To: vim-dev@vim.org
Subject: Patch 7.0.126
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.126
Problem:    When 'formatexpr' uses setline() and later internal formatting is
	    used undo information is not correct. (Jiri Cerny, Benji Fisher)
Solution:   Set ins_need_undo after using 'formatexpr'.
Files:	    src/edit.c


*** ../vim-7.0.125/src/edit.c	Fri Oct  6 20:39:58 2006
--- src/edit.c	Tue Oct 10 12:46:04 2006
***************
*** 5333,5340 ****
  	/* Format with 'formatexpr' when it's set.  Use internal formatting
  	 * when 'formatexpr' isn't set or it returns non-zero. */
  #if defined(FEAT_EVAL)
! 	if (*curbuf->b_p_fex == NUL
! 			     || fex_format(curwin->w_cursor.lnum, 1L, c) != 0)
  #endif
  	    internal_format(textwidth, second_indent, flags, c == NUL);
      }
--- 5333,5348 ----
  	/* Format with 'formatexpr' when it's set.  Use internal formatting
  	 * when 'formatexpr' isn't set or it returns non-zero. */
  #if defined(FEAT_EVAL)
! 	int do_internal = TRUE;
! 
! 	if (*curbuf->b_p_fex != NUL)
! 	{
! 	    do_internal = (fex_format(curwin->w_cursor.lnum, 1L, c) != 0);
! 	    /* It may be required to save for undo again, e.g. when setline()
! 	     * was called. */
! 	    ins_need_undo = TRUE;
! 	}
! 	if (do_internal)
  #endif
  	    internal_format(textwidth, second_indent, flags, c == NUL);
      }
*** ../vim-7.0.125/src/version.c	Tue Oct 10 13:27:30 2006
--- src/version.c	Tue Oct 10 15:47:20 2006
***************
*** 668,669 ****
--- 668,671 ----
  {   /* Add new patch number below this line */
+ /**/
+     126,
  /**/

-- 
How To Keep A Healthy Level Of Insanity:
16. Have your coworkers address you by your wrestling name, Rock Hard Kim.

 /// 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    ///