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