]>
Commit | Line | Data |
---|---|---|
c84df032 ER |
1 | To: vim-dev@vim.org |
2 | Subject: Patch 7.0.160 | |
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.0.160 | |
11 | Problem: ":@a" echoes the command, Vi doesn't do that. | |
12 | Solution: Set the silent flag in the typeahead buffer to avoid echoing the | |
13 | command. | |
14 | Files: src/ex_docmd.c, src/normal.c, src/ops.c, src/proto/ops.pro | |
15 | ||
16 | ||
17 | *** ../vim-7.0.159/src/ex_docmd.c Tue Oct 24 13:02:27 2006 | |
18 | --- src/ex_docmd.c Tue Nov 7 17:42:52 2006 | |
19 | *************** | |
20 | *** 8219,8226 **** | |
21 | c = *eap->arg; | |
22 | if (c == NUL || (c == '*' && *eap->cmd == '*')) | |
23 | c = '@'; | |
24 | ! /* put the register in mapbuf */ | |
25 | ! if (do_execreg(c, TRUE, vim_strchr(p_cpo, CPO_EXECBUF) != NULL) == FAIL) | |
26 | { | |
27 | beep_flush(); | |
28 | } | |
29 | --- 8219,8227 ---- | |
30 | c = *eap->arg; | |
31 | if (c == NUL || (c == '*' && *eap->cmd == '*')) | |
32 | c = '@'; | |
33 | ! /* Put the register in the typeahead buffer with the "silent" flag. */ | |
34 | ! if (do_execreg(c, TRUE, vim_strchr(p_cpo, CPO_EXECBUF) != NULL, TRUE) | |
35 | ! == FAIL) | |
36 | { | |
37 | beep_flush(); | |
38 | } | |
39 | *** ../vim-7.0.159/src/normal.c Tue Oct 17 22:40:14 2006 | |
40 | --- src/normal.c Tue Nov 7 17:42:59 2006 | |
41 | *************** | |
42 | *** 8860,8866 **** | |
43 | #endif | |
44 | while (cap->count1-- && !got_int) | |
45 | { | |
46 | ! if (do_execreg(cap->nchar, FALSE, FALSE) == FAIL) | |
47 | { | |
48 | clearopbeep(cap->oap); | |
49 | break; | |
50 | --- 8860,8866 ---- | |
51 | #endif | |
52 | while (cap->count1-- && !got_int) | |
53 | { | |
54 | ! if (do_execreg(cap->nchar, FALSE, FALSE, FALSE) == FAIL) | |
55 | { | |
56 | clearopbeep(cap->oap); | |
57 | break; | |
58 | *** ../vim-7.0.159/src/ops.c Tue Oct 17 16:26:52 2006 | |
59 | --- src/ops.c Tue Nov 7 17:52:30 2006 | |
60 | *************** | |
61 | *** 95,102 **** | |
62 | static void block_insert __ARGS((oparg_T *oap, char_u *s, int b_insert, struct block_def*bdp)); | |
63 | #endif | |
64 | static int stuff_yank __ARGS((int, char_u *)); | |
65 | ! static void put_reedit_in_typebuf __ARGS((void)); | |
66 | ! static int put_in_typebuf __ARGS((char_u *s, int colon)); | |
67 | static void stuffescaped __ARGS((char_u *arg, int literally)); | |
68 | #ifdef FEAT_MBYTE | |
69 | static void mb_adjust_opend __ARGS((oparg_T *oap)); | |
70 | --- 95,102 ---- | |
71 | static void block_insert __ARGS((oparg_T *oap, char_u *s, int b_insert, struct block_def*bdp)); | |
72 | #endif | |
73 | static int stuff_yank __ARGS((int, char_u *)); | |
74 | ! static void put_reedit_in_typebuf __ARGS((int silent)); | |
75 | ! static int put_in_typebuf __ARGS((char_u *s, int colon, int silent)); | |
76 | static void stuffescaped __ARGS((char_u *arg, int literally)); | |
77 | #ifdef FEAT_MBYTE | |
78 | static void mb_adjust_opend __ARGS((oparg_T *oap)); | |
79 | *************** | |
80 | *** 1120,1129 **** | |
81 | * return FAIL for failure, OK otherwise | |
82 | */ | |
83 | int | |
84 | ! do_execreg(regname, colon, addcr) | |
85 | int regname; | |
86 | int colon; /* insert ':' before each line */ | |
87 | int addcr; /* always add '\n' to end of line */ | |
88 | { | |
89 | static int lastc = NUL; | |
90 | long i; | |
91 | --- 1120,1130 ---- | |
92 | * return FAIL for failure, OK otherwise | |
93 | */ | |
94 | int | |
95 | ! do_execreg(regname, colon, addcr, silent) | |
96 | int regname; | |
97 | int colon; /* insert ':' before each line */ | |
98 | int addcr; /* always add '\n' to end of line */ | |
99 | + int silent; /* set "silent" flag in typeahead buffer */ | |
100 | { | |
101 | static int lastc = NUL; | |
102 | long i; | |
103 | *************** | |
104 | *** 1173,1181 **** | |
105 | /* When in Visual mode "'<,'>" will be prepended to the command. | |
106 | * Remove it when it's already there. */ | |
107 | if (VIsual_active && STRNCMP(p, "'<,'>", 5) == 0) | |
108 | ! retval = put_in_typebuf(p + 5, TRUE); | |
109 | else | |
110 | ! retval = put_in_typebuf(p, TRUE); | |
111 | } | |
112 | vim_free(p); | |
113 | } | |
114 | --- 1174,1182 ---- | |
115 | /* When in Visual mode "'<,'>" will be prepended to the command. | |
116 | * Remove it when it's already there. */ | |
117 | if (VIsual_active && STRNCMP(p, "'<,'>", 5) == 0) | |
118 | ! retval = put_in_typebuf(p + 5, TRUE, silent); | |
119 | else | |
120 | ! retval = put_in_typebuf(p, TRUE, silent); | |
121 | } | |
122 | vim_free(p); | |
123 | } | |
124 | *************** | |
125 | *** 1186,1192 **** | |
126 | p = get_expr_line(); | |
127 | if (p == NULL) | |
128 | return FAIL; | |
129 | ! retval = put_in_typebuf(p, colon); | |
130 | vim_free(p); | |
131 | } | |
132 | #endif | |
133 | --- 1187,1193 ---- | |
134 | p = get_expr_line(); | |
135 | if (p == NULL) | |
136 | return FAIL; | |
137 | ! retval = put_in_typebuf(p, colon, silent); | |
138 | vim_free(p); | |
139 | } | |
140 | #endif | |
141 | *************** | |
142 | *** 1198,1204 **** | |
143 | EMSG(_(e_noinstext)); | |
144 | return FAIL; | |
145 | } | |
146 | ! retval = put_in_typebuf(p, colon); | |
147 | vim_free(p); | |
148 | } | |
149 | else | |
150 | --- 1199,1205 ---- | |
151 | EMSG(_(e_noinstext)); | |
152 | return FAIL; | |
153 | } | |
154 | ! retval = put_in_typebuf(p, colon, silent); | |
155 | vim_free(p); | |
156 | } | |
157 | else | |
158 | *************** | |
159 | *** 1213,1232 **** | |
160 | /* | |
161 | * Insert lines into typeahead buffer, from last one to first one. | |
162 | */ | |
163 | ! put_reedit_in_typebuf(); | |
164 | for (i = y_current->y_size; --i >= 0; ) | |
165 | { | |
166 | /* insert NL between lines and after last line if type is MLINE */ | |
167 | if (y_current->y_type == MLINE || i < y_current->y_size - 1 | |
168 | || addcr) | |
169 | { | |
170 | ! if (ins_typebuf((char_u *)"\n", remap, 0, TRUE, FALSE) == FAIL) | |
171 | return FAIL; | |
172 | } | |
173 | ! if (ins_typebuf(y_current->y_array[i], remap, 0, TRUE, FALSE) | |
174 | == FAIL) | |
175 | return FAIL; | |
176 | ! if (colon && ins_typebuf((char_u *)":", remap, 0, TRUE, FALSE) | |
177 | == FAIL) | |
178 | return FAIL; | |
179 | } | |
180 | --- 1214,1233 ---- | |
181 | /* | |
182 | * Insert lines into typeahead buffer, from last one to first one. | |
183 | */ | |
184 | ! put_reedit_in_typebuf(silent); | |
185 | for (i = y_current->y_size; --i >= 0; ) | |
186 | { | |
187 | /* insert NL between lines and after last line if type is MLINE */ | |
188 | if (y_current->y_type == MLINE || i < y_current->y_size - 1 | |
189 | || addcr) | |
190 | { | |
191 | ! if (ins_typebuf((char_u *)"\n", remap, 0, TRUE, silent) == FAIL) | |
192 | return FAIL; | |
193 | } | |
194 | ! if (ins_typebuf(y_current->y_array[i], remap, 0, TRUE, silent) | |
195 | == FAIL) | |
196 | return FAIL; | |
197 | ! if (colon && ins_typebuf((char_u *)":", remap, 0, TRUE, silent) | |
198 | == FAIL) | |
199 | return FAIL; | |
200 | } | |
201 | *************** | |
202 | *** 1240,1246 **** | |
203 | * used only after other typeahead has been processed. | |
204 | */ | |
205 | static void | |
206 | ! put_reedit_in_typebuf() | |
207 | { | |
208 | char_u buf[3]; | |
209 | ||
210 | --- 1241,1248 ---- | |
211 | * used only after other typeahead has been processed. | |
212 | */ | |
213 | static void | |
214 | ! put_reedit_in_typebuf(silent) | |
215 | ! int silent; | |
216 | { | |
217 | char_u buf[3]; | |
218 | ||
219 | *************** | |
220 | *** 1257,1281 **** | |
221 | buf[0] = restart_edit == 'I' ? 'i' : restart_edit; | |
222 | buf[1] = NUL; | |
223 | } | |
224 | ! if (ins_typebuf(buf, REMAP_NONE, 0, TRUE, FALSE) == OK) | |
225 | restart_edit = NUL; | |
226 | } | |
227 | } | |
228 | ||
229 | static int | |
230 | ! put_in_typebuf(s, colon) | |
231 | char_u *s; | |
232 | int colon; /* add ':' before the line */ | |
233 | { | |
234 | int retval = OK; | |
235 | ||
236 | ! put_reedit_in_typebuf(); | |
237 | if (colon) | |
238 | ! retval = ins_typebuf((char_u *)"\n", REMAP_YES, 0, TRUE, FALSE); | |
239 | if (retval == OK) | |
240 | ! retval = ins_typebuf(s, REMAP_YES, 0, TRUE, FALSE); | |
241 | if (colon && retval == OK) | |
242 | ! retval = ins_typebuf((char_u *)":", REMAP_YES, 0, TRUE, FALSE); | |
243 | return retval; | |
244 | } | |
245 | ||
246 | --- 1259,1284 ---- | |
247 | buf[0] = restart_edit == 'I' ? 'i' : restart_edit; | |
248 | buf[1] = NUL; | |
249 | } | |
250 | ! if (ins_typebuf(buf, REMAP_NONE, 0, TRUE, silent) == OK) | |
251 | restart_edit = NUL; | |
252 | } | |
253 | } | |
254 | ||
255 | static int | |
256 | ! put_in_typebuf(s, colon, silent) | |
257 | char_u *s; | |
258 | int colon; /* add ':' before the line */ | |
259 | + int silent; | |
260 | { | |
261 | int retval = OK; | |
262 | ||
263 | ! put_reedit_in_typebuf(silent); | |
264 | if (colon) | |
265 | ! retval = ins_typebuf((char_u *)"\n", REMAP_YES, 0, TRUE, silent); | |
266 | if (retval == OK) | |
267 | ! retval = ins_typebuf(s, REMAP_YES, 0, TRUE, silent); | |
268 | if (colon && retval == OK) | |
269 | ! retval = ins_typebuf((char_u *)":", REMAP_YES, 0, TRUE, silent); | |
270 | return retval; | |
271 | } | |
272 | ||
273 | *** ../vim-7.0.159/src/proto/ops.pro Tue Oct 17 16:26:52 2006 | |
274 | --- src/proto/ops.pro Tue Nov 7 18:08:35 2006 | |
275 | *************** | |
276 | *** 17,23 **** | |
277 | extern void put_register __ARGS((int name, void *reg)); | |
278 | extern int yank_register_mline __ARGS((int regname)); | |
279 | extern int do_record __ARGS((int c)); | |
280 | ! extern int do_execreg __ARGS((int regname, int colon, int addcr)); | |
281 | extern int insert_reg __ARGS((int regname, int literally)); | |
282 | extern int get_spec_reg __ARGS((int regname, char_u **argp, int *allocated, int errmsg)); | |
283 | extern int cmdline_paste_reg __ARGS((int regname, int literally, int remcr)); | |
284 | --- 17,23 ---- | |
285 | extern void put_register __ARGS((int name, void *reg)); | |
286 | extern int yank_register_mline __ARGS((int regname)); | |
287 | extern int do_record __ARGS((int c)); | |
288 | ! extern int do_execreg __ARGS((int regname, int colon, int addcr, int silent)); | |
289 | extern int insert_reg __ARGS((int regname, int literally)); | |
290 | extern int get_spec_reg __ARGS((int regname, char_u **argp, int *allocated, int errmsg)); | |
291 | extern int cmdline_paste_reg __ARGS((int regname, int literally, int remcr)); | |
292 | *** ../vim-7.0.159/src/version.c Tue Nov 7 18:02:19 2006 | |
293 | --- src/version.c Tue Nov 7 18:05:36 2006 | |
294 | *************** | |
295 | *** 668,669 **** | |
296 | --- 668,671 ---- | |
297 | { /* Add new patch number below this line */ | |
298 | + /**/ | |
299 | + 160, | |
300 | /**/ | |
301 | ||
302 | -- | |
303 | hundred-and-one symptoms of being an internet addict: | |
304 | 172. You join listservers just for the extra e-mail. | |
305 | ||
306 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
307 | /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ | |
308 | \\\ download, build and distribute -- http://www.A-A-P.org /// | |
309 | \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |