4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=ISO-8859-1
7 Content-Transfer-Encoding: 8bit
11 Problem: "gw" uses 'formatexpr', even though the docs say it doesn't.
12 Solution: Don't use 'formatexpr' for "gw".
13 Files: src/vim.h, src/edit.c, src/ops.c, src/proto/ops.pro
16 *** ../vim-7.1.275/src/vim.h Wed Mar 12 14:38:51 2008
17 --- src/vim.h Wed Mar 12 16:31:44 2008
21 #define INSCHAR_FORMAT 1 /* force formatting */
22 #define INSCHAR_DO_COM 2 /* format comments */
23 #define INSCHAR_CTRLV 4 /* char typed just after CTRL-V */
24 + #define INSCHAR_NO_FEX 8 /* don't use 'formatexpr' */
26 /* flags for open_line() */
27 #define OPENLINE_DELSPACES 1 /* delete spaces after cursor */
28 *** ../vim-7.1.275/src/edit.c Tue Jan 22 17:49:17 2008
29 --- src/edit.c Wed Mar 12 16:35:44 2008
32 #if defined(FEAT_EVAL)
33 int do_internal = TRUE;
35 ! if (*curbuf->b_p_fex != NUL)
37 do_internal = (fex_format(curwin->w_cursor.lnum, 1L, c) != 0);
38 /* It may be required to save for undo again, e.g. when setline()
40 #if defined(FEAT_EVAL)
41 int do_internal = TRUE;
43 ! if (*curbuf->b_p_fex != NUL && (flags & INSCHAR_NO_FEX) == 0)
45 do_internal = (fex_format(curwin->w_cursor.lnum, 1L, c) != 0);
46 /* It may be required to save for undo again, e.g. when setline()
49 * be adjusted for the text formatting.
52 ! format_lines((linenr_T)-1);
53 curwin->w_cursor = saved_cursor;
54 saved_cursor.lnum = 0;
57 * be adjusted for the text formatting.
60 ! format_lines((linenr_T)-1, FALSE);
61 curwin->w_cursor = saved_cursor;
62 saved_cursor.lnum = 0;
64 *** ../vim-7.1.275/src/ops.c Mon Feb 25 21:54:23 2008
65 --- src/ops.c Wed Mar 12 16:37:29 2008
69 saved_cursor = oap->cursor_start;
71 ! format_lines(oap->line_count);
74 * Leave the cursor at the first non-blank of the last formatted line.
77 saved_cursor = oap->cursor_start;
79 ! format_lines(oap->line_count, keep_cursor);
82 * Leave the cursor at the first non-blank of the last formatted line.
88 ! format_lines(line_count)
92 int is_not_par; /* current line not part of parag. */
97 ! format_lines(line_count, avoid_fex)
99 + int avoid_fex; /* don't use 'formatexpr' */
102 int is_not_par; /* current line not part of parag. */
106 + (do_comments ? INSCHAR_DO_COM : 0)
114 + (do_comments ? INSCHAR_DO_COM : 0)
116 ! + (avoid_fex ? INSCHAR_NO_FEX : 0), second_indent);
120 *** ../vim-7.1.275/src/proto/ops.pro Wed Jan 16 20:01:14 2008
121 --- src/proto/ops.pro Wed Mar 12 16:38:39 2008
124 void op_format __ARGS((oparg_T *oap, int keep_cursor));
125 void op_formatexpr __ARGS((oparg_T *oap));
126 int fex_format __ARGS((linenr_T lnum, long count, int c));
127 ! void format_lines __ARGS((linenr_T line_count));
128 int paragraph_start __ARGS((linenr_T lnum));
129 int do_addsub __ARGS((int command, linenr_T Prenum1));
130 int read_viminfo_register __ARGS((vir_T *virp, int force));
132 void op_format __ARGS((oparg_T *oap, int keep_cursor));
133 void op_formatexpr __ARGS((oparg_T *oap));
134 int fex_format __ARGS((linenr_T lnum, long count, int c));
135 ! void format_lines __ARGS((linenr_T line_count, int avoid_fex));
136 int paragraph_start __ARGS((linenr_T lnum));
137 int do_addsub __ARGS((int command, linenr_T Prenum1));
138 int read_viminfo_register __ARGS((vir_T *virp, int force));
139 *** ../vim-7.1.275/src/version.c Wed Mar 12 14:38:51 2008
140 --- src/version.c Wed Mar 12 17:23:43 2008
144 { /* Add new patch number below this line */
150 An actual excerpt from a classified section of a city newspaper:
151 "Illiterate? Write today for free help!"
153 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
154 /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
155 \\\ download, build and distribute -- http://www.A-A-P.org ///
156 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///