3521e3f
To: vim-dev@vim.org
3521e3f
Subject: Patch 7.1.276
3521e3f
Fcc: outbox
3521e3f
From: Bram Moolenaar <Bram@moolenaar.net>
3521e3f
Mime-Version: 1.0
3521e3f
Content-Type: text/plain; charset=ISO-8859-1
3521e3f
Content-Transfer-Encoding: 8bit
3521e3f
------------
3521e3f
3521e3f
Patch 7.1.276
3521e3f
Problem:    "gw" uses 'formatexpr', even though the docs say it doesn't.
3521e3f
Solution:   Don't use 'formatexpr' for "gw".
3521e3f
Files:	    src/vim.h, src/edit.c, src/ops.c, src/proto/ops.pro
3521e3f
3521e3f
3521e3f
*** ../vim-7.1.275/src/vim.h	Wed Mar 12 14:38:51 2008
3521e3f
--- src/vim.h	Wed Mar 12 16:31:44 2008
3521e3f
***************
3521e3f
*** 949,954 ****
3521e3f
--- 952,958 ----
3521e3f
  #define INSCHAR_FORMAT	1	/* force formatting */
3521e3f
  #define INSCHAR_DO_COM	2	/* format comments */
3521e3f
  #define INSCHAR_CTRLV	4	/* char typed just after CTRL-V */
3521e3f
+ #define INSCHAR_NO_FEX	8	/* don't use 'formatexpr' */
3521e3f
  
3521e3f
  /* flags for open_line() */
3521e3f
  #define OPENLINE_DELSPACES  1	/* delete spaces after cursor */
3521e3f
*** ../vim-7.1.275/src/edit.c	Tue Jan 22 17:49:17 2008
3521e3f
--- src/edit.c	Wed Mar 12 16:35:44 2008
3521e3f
***************
3521e3f
*** 5491,5497 ****
3521e3f
  #if defined(FEAT_EVAL)
3521e3f
  	int do_internal = TRUE;
3521e3f
  
3521e3f
! 	if (*curbuf->b_p_fex != NUL)
3521e3f
  	{
3521e3f
  	    do_internal = (fex_format(curwin->w_cursor.lnum, 1L, c) != 0);
3521e3f
  	    /* It may be required to save for undo again, e.g. when setline()
3521e3f
--- 5491,5497 ----
3521e3f
  #if defined(FEAT_EVAL)
3521e3f
  	int do_internal = TRUE;
3521e3f
  
3521e3f
! 	if (*curbuf->b_p_fex != NUL && (flags & INSCHAR_NO_FEX) == 0)
3521e3f
  	{
3521e3f
  	    do_internal = (fex_format(curwin->w_cursor.lnum, 1L, c) != 0);
3521e3f
  	    /* It may be required to save for undo again, e.g. when setline()
3521e3f
***************
3521e3f
*** 6057,6063 ****
3521e3f
       * be adjusted for the text formatting.
3521e3f
       */
3521e3f
      saved_cursor = pos;
3521e3f
!     format_lines((linenr_T)-1);
3521e3f
      curwin->w_cursor = saved_cursor;
3521e3f
      saved_cursor.lnum = 0;
3521e3f
  
3521e3f
--- 6057,6063 ----
3521e3f
       * be adjusted for the text formatting.
3521e3f
       */
3521e3f
      saved_cursor = pos;
3521e3f
!     format_lines((linenr_T)-1, FALSE);
3521e3f
      curwin->w_cursor = saved_cursor;
3521e3f
      saved_cursor.lnum = 0;
3521e3f
  
3521e3f
*** ../vim-7.1.275/src/ops.c	Mon Feb 25 21:54:23 2008
3521e3f
--- src/ops.c	Wed Mar 12 16:37:29 2008
3521e3f
***************
3521e3f
*** 4380,4386 ****
3521e3f
      if (keep_cursor)
3521e3f
  	saved_cursor = oap->cursor_start;
3521e3f
  
3521e3f
!     format_lines(oap->line_count);
3521e3f
  
3521e3f
      /*
3521e3f
       * Leave the cursor at the first non-blank of the last formatted line.
3521e3f
--- 4380,4386 ----
3521e3f
      if (keep_cursor)
3521e3f
  	saved_cursor = oap->cursor_start;
3521e3f
  
3521e3f
!     format_lines(oap->line_count, keep_cursor);
3521e3f
  
3521e3f
      /*
3521e3f
       * Leave the cursor at the first non-blank of the last formatted line.
3521e3f
***************
3521e3f
*** 4495,4502 ****
3521e3f
   * first line.
3521e3f
   */
3521e3f
      void
3521e3f
! format_lines(line_count)
3521e3f
      linenr_T	line_count;
3521e3f
  {
3521e3f
      int		max_len;
3521e3f
      int		is_not_par;		/* current line not part of parag. */
3521e3f
--- 4495,4503 ----
3521e3f
   * first line.
3521e3f
   */
3521e3f
      void
3521e3f
! format_lines(line_count, avoid_fex)
3521e3f
      linenr_T	line_count;
3521e3f
+     int		avoid_fex;		/* don't use 'formatexpr' */
3521e3f
  {
3521e3f
      int		max_len;
3521e3f
      int		is_not_par;		/* current line not part of parag. */
3521e3f
***************
3521e3f
*** 4666,4672 ****
3521e3f
  #ifdef FEAT_COMMENTS
3521e3f
  			+ (do_comments ? INSCHAR_DO_COM : 0)
3521e3f
  #endif
3521e3f
! 			, second_indent);
3521e3f
  		State = old_State;
3521e3f
  		p_smd = smd_save;
3521e3f
  		second_indent = -1;
3521e3f
--- 4667,4673 ----
3521e3f
  #ifdef FEAT_COMMENTS
3521e3f
  			+ (do_comments ? INSCHAR_DO_COM : 0)
3521e3f
  #endif
3521e3f
! 			+ (avoid_fex ? INSCHAR_NO_FEX : 0), second_indent);
3521e3f
  		State = old_State;
3521e3f
  		p_smd = smd_save;
3521e3f
  		second_indent = -1;
3521e3f
*** ../vim-7.1.275/src/proto/ops.pro	Wed Jan 16 20:01:14 2008
3521e3f
--- src/proto/ops.pro	Wed Mar 12 16:38:39 2008
3521e3f
***************
3521e3f
*** 41,47 ****
3521e3f
  void op_format __ARGS((oparg_T *oap, int keep_cursor));
3521e3f
  void op_formatexpr __ARGS((oparg_T *oap));
3521e3f
  int fex_format __ARGS((linenr_T lnum, long count, int c));
3521e3f
! void format_lines __ARGS((linenr_T line_count));
3521e3f
  int paragraph_start __ARGS((linenr_T lnum));
3521e3f
  int do_addsub __ARGS((int command, linenr_T Prenum1));
3521e3f
  int read_viminfo_register __ARGS((vir_T *virp, int force));
3521e3f
--- 41,47 ----
3521e3f
  void op_format __ARGS((oparg_T *oap, int keep_cursor));
3521e3f
  void op_formatexpr __ARGS((oparg_T *oap));
3521e3f
  int fex_format __ARGS((linenr_T lnum, long count, int c));
3521e3f
! void format_lines __ARGS((linenr_T line_count, int avoid_fex));
3521e3f
  int paragraph_start __ARGS((linenr_T lnum));
3521e3f
  int do_addsub __ARGS((int command, linenr_T Prenum1));
3521e3f
  int read_viminfo_register __ARGS((vir_T *virp, int force));
3521e3f
*** ../vim-7.1.275/src/version.c	Wed Mar 12 14:38:51 2008
3521e3f
--- src/version.c	Wed Mar 12 17:23:43 2008
3521e3f
***************
3521e3f
*** 668,669 ****
3521e3f
--- 668,671 ----
3521e3f
  {   /* Add new patch number below this line */
3521e3f
+ /**/
3521e3f
+     276,
3521e3f
  /**/
3521e3f
3521e3f
-- 
3521e3f
An actual excerpt from a classified section of a city newspaper:
3521e3f
"Illiterate?  Write today for free help!"
3521e3f
3521e3f
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
3521e3f
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
3521e3f
\\\        download, build and distribute -- http://www.A-A-P.org        ///
3521e3f
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///