]>
Commit | Line | Data |
---|---|---|
ef75664d AG |
1 | To: vim-dev@vim.org |
2 | Subject: Patch 7.1.276 | |
3 | Fcc: outbox | |
4 | From: Bram Moolenaar <Bram@moolenaar.net> | |
5 | Mime-Version: 1.0 | |
6 | Content-Type: text/plain; charset=ISO-8859-1 | |
7 | Content-Transfer-Encoding: 8bit | |
8 | ------------ | |
9 | ||
10 | Patch 7.1.276 | |
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 | |
14 | ||
15 | ||
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 | |
18 | *************** | |
19 | *** 949,954 **** | |
20 | --- 952,958 ---- | |
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' */ | |
25 | ||
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 | |
30 | *************** | |
31 | *** 5491,5497 **** | |
32 | #if defined(FEAT_EVAL) | |
33 | int do_internal = TRUE; | |
34 | ||
35 | ! if (*curbuf->b_p_fex != NUL) | |
36 | { | |
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() | |
39 | --- 5491,5497 ---- | |
40 | #if defined(FEAT_EVAL) | |
41 | int do_internal = TRUE; | |
42 | ||
43 | ! if (*curbuf->b_p_fex != NUL && (flags & INSCHAR_NO_FEX) == 0) | |
44 | { | |
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() | |
47 | *************** | |
48 | *** 6057,6063 **** | |
49 | * be adjusted for the text formatting. | |
50 | */ | |
51 | saved_cursor = pos; | |
52 | ! format_lines((linenr_T)-1); | |
53 | curwin->w_cursor = saved_cursor; | |
54 | saved_cursor.lnum = 0; | |
55 | ||
56 | --- 6057,6063 ---- | |
57 | * be adjusted for the text formatting. | |
58 | */ | |
59 | saved_cursor = pos; | |
60 | ! format_lines((linenr_T)-1, FALSE); | |
61 | curwin->w_cursor = saved_cursor; | |
62 | saved_cursor.lnum = 0; | |
63 | ||
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 | |
66 | *************** | |
67 | *** 4380,4386 **** | |
68 | if (keep_cursor) | |
69 | saved_cursor = oap->cursor_start; | |
70 | ||
71 | ! format_lines(oap->line_count); | |
72 | ||
73 | /* | |
74 | * Leave the cursor at the first non-blank of the last formatted line. | |
75 | --- 4380,4386 ---- | |
76 | if (keep_cursor) | |
77 | saved_cursor = oap->cursor_start; | |
78 | ||
79 | ! format_lines(oap->line_count, keep_cursor); | |
80 | ||
81 | /* | |
82 | * Leave the cursor at the first non-blank of the last formatted line. | |
83 | *************** | |
84 | *** 4495,4502 **** | |
85 | * first line. | |
86 | */ | |
87 | void | |
88 | ! format_lines(line_count) | |
89 | linenr_T line_count; | |
90 | { | |
91 | int max_len; | |
92 | int is_not_par; /* current line not part of parag. */ | |
93 | --- 4495,4503 ---- | |
94 | * first line. | |
95 | */ | |
96 | void | |
97 | ! format_lines(line_count, avoid_fex) | |
98 | linenr_T line_count; | |
99 | + int avoid_fex; /* don't use 'formatexpr' */ | |
100 | { | |
101 | int max_len; | |
102 | int is_not_par; /* current line not part of parag. */ | |
103 | *************** | |
104 | *** 4666,4672 **** | |
105 | #ifdef FEAT_COMMENTS | |
106 | + (do_comments ? INSCHAR_DO_COM : 0) | |
107 | #endif | |
108 | ! , second_indent); | |
109 | State = old_State; | |
110 | p_smd = smd_save; | |
111 | second_indent = -1; | |
112 | --- 4667,4673 ---- | |
113 | #ifdef FEAT_COMMENTS | |
114 | + (do_comments ? INSCHAR_DO_COM : 0) | |
115 | #endif | |
116 | ! + (avoid_fex ? INSCHAR_NO_FEX : 0), second_indent); | |
117 | State = old_State; | |
118 | p_smd = smd_save; | |
119 | second_indent = -1; | |
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 | |
122 | *************** | |
123 | *** 41,47 **** | |
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)); | |
131 | --- 41,47 ---- | |
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 | |
141 | *************** | |
142 | *** 668,669 **** | |
143 | --- 668,671 ---- | |
144 | { /* Add new patch number below this line */ | |
145 | + /**/ | |
146 | + 276, | |
147 | /**/ | |
148 | ||
149 | -- | |
150 | An actual excerpt from a classified section of a city newspaper: | |
151 | "Illiterate? Write today for free help!" | |
152 | ||
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 /// |