changeset 1563:ed7fefbef738 v7.1.276

updated for version 7.1-276
author vimboss
date Wed, 12 Mar 2008 16:27:00 +0000
parents 437fb19625c9
children 8c9396275bfa
files src/edit.c src/ops.c src/proto/ops.pro src/version.c src/vim.h
diffstat 5 files changed, 10 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/edit.c
+++ b/src/edit.c
@@ -5491,7 +5491,7 @@ insertchar(c, flags, second_indent)
 #if defined(FEAT_EVAL)
 	int do_internal = TRUE;
 
-	if (*curbuf->b_p_fex != NUL)
+	if (*curbuf->b_p_fex != NUL && (flags & INSCHAR_NO_FEX) == 0)
 	{
 	    do_internal = (fex_format(curwin->w_cursor.lnum, 1L, c) != 0);
 	    /* It may be required to save for undo again, e.g. when setline()
@@ -6057,7 +6057,7 @@ auto_format(trailblank, prev_line)
      * be adjusted for the text formatting.
      */
     saved_cursor = pos;
-    format_lines((linenr_T)-1);
+    format_lines((linenr_T)-1, FALSE);
     curwin->w_cursor = saved_cursor;
     saved_cursor.lnum = 0;
 
--- a/src/ops.c
+++ b/src/ops.c
@@ -4380,7 +4380,7 @@ op_format(oap, keep_cursor)
     if (keep_cursor)
 	saved_cursor = oap->cursor_start;
 
-    format_lines(oap->line_count);
+    format_lines(oap->line_count, keep_cursor);
 
     /*
      * Leave the cursor at the first non-blank of the last formatted line.
@@ -4495,8 +4495,9 @@ fex_format(lnum, count, c)
  * first line.
  */
     void
-format_lines(line_count)
+format_lines(line_count, avoid_fex)
     linenr_T	line_count;
+    int		avoid_fex;		/* don't use 'formatexpr' */
 {
     int		max_len;
     int		is_not_par;		/* current line not part of parag. */
@@ -4666,7 +4667,7 @@ format_lines(line_count)
 #ifdef FEAT_COMMENTS
 			+ (do_comments ? INSCHAR_DO_COM : 0)
 #endif
-			, second_indent);
+			+ (avoid_fex ? INSCHAR_NO_FEX : 0), second_indent);
 		State = old_State;
 		p_smd = smd_save;
 		second_indent = -1;
--- a/src/proto/ops.pro
+++ b/src/proto/ops.pro
@@ -41,7 +41,7 @@ int do_join __ARGS((int insert_space));
 void op_format __ARGS((oparg_T *oap, int keep_cursor));
 void op_formatexpr __ARGS((oparg_T *oap));
 int fex_format __ARGS((linenr_T lnum, long count, int c));
-void format_lines __ARGS((linenr_T line_count));
+void format_lines __ARGS((linenr_T line_count, int avoid_fex));
 int paragraph_start __ARGS((linenr_T lnum));
 int do_addsub __ARGS((int command, linenr_T Prenum1));
 int read_viminfo_register __ARGS((vir_T *virp, int force));
--- a/src/version.c
+++ b/src/version.c
@@ -667,6 +667,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    276,
+/**/
     275,
 /**/
     274,
--- a/src/vim.h
+++ b/src/vim.h
@@ -949,6 +949,7 @@ extern char *(*dyn_libintl_textdomain)(c
 #define INSCHAR_FORMAT	1	/* force formatting */
 #define INSCHAR_DO_COM	2	/* format comments */
 #define INSCHAR_CTRLV	4	/* char typed just after CTRL-V */
+#define INSCHAR_NO_FEX	8	/* don't use 'formatexpr' */
 
 /* flags for open_line() */
 #define OPENLINE_DELSPACES  1	/* delete spaces after cursor */