4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=ISO-8859-1
7 Content-Transfer-Encoding: 8bit
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
14 Files: src/ex_docmd.c, src/normal.c, src/ops.c, src/proto/ops.pro
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
22 if (c == NUL || (c == '*' && *eap->cmd == '*'))
24 ! /* put the register in mapbuf */
25 ! if (do_execreg(c, TRUE, vim_strchr(p_cpo, CPO_EXECBUF) != NULL) == FAIL)
31 if (c == NUL || (c == '*' && *eap->cmd == '*'))
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)
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
44 while (cap->count1-- && !got_int)
46 ! if (do_execreg(cap->nchar, FALSE, FALSE) == FAIL)
48 clearopbeep(cap->oap);
52 while (cap->count1-- && !got_int)
54 ! if (do_execreg(cap->nchar, FALSE, FALSE, FALSE) == FAIL)
56 clearopbeep(cap->oap);
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
62 static void block_insert __ARGS((oparg_T *oap, char_u *s, int b_insert, struct block_def*bdp));
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));
69 static void mb_adjust_opend __ARGS((oparg_T *oap));
71 static void block_insert __ARGS((oparg_T *oap, char_u *s, int b_insert, struct block_def*bdp));
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));
78 static void mb_adjust_opend __ARGS((oparg_T *oap));
81 * return FAIL for failure, OK otherwise
84 ! do_execreg(regname, colon, addcr)
86 int colon; /* insert ':' before each line */
87 int addcr; /* always add '\n' to end of line */
89 static int lastc = NUL;
92 * return FAIL for failure, OK otherwise
95 ! do_execreg(regname, colon, addcr, silent)
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 */
101 static int lastc = NUL;
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);
110 ! retval = put_in_typebuf(p, TRUE);
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);
120 ! retval = put_in_typebuf(p, TRUE, silent);
129 ! retval = put_in_typebuf(p, colon);
137 ! retval = put_in_typebuf(p, colon, silent);
143 EMSG(_(e_noinstext));
146 ! retval = put_in_typebuf(p, colon);
151 EMSG(_(e_noinstext));
154 ! retval = put_in_typebuf(p, colon, silent);
161 * Insert lines into typeahead buffer, from last one to first one.
163 ! put_reedit_in_typebuf();
164 for (i = y_current->y_size; --i >= 0; )
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
170 ! if (ins_typebuf((char_u *)"\n", remap, 0, TRUE, FALSE) == FAIL)
173 ! if (ins_typebuf(y_current->y_array[i], remap, 0, TRUE, FALSE)
176 ! if (colon && ins_typebuf((char_u *)":", remap, 0, TRUE, FALSE)
182 * Insert lines into typeahead buffer, from last one to first one.
184 ! put_reedit_in_typebuf(silent);
185 for (i = y_current->y_size; --i >= 0; )
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
191 ! if (ins_typebuf((char_u *)"\n", remap, 0, TRUE, silent) == FAIL)
194 ! if (ins_typebuf(y_current->y_array[i], remap, 0, TRUE, silent)
197 ! if (colon && ins_typebuf((char_u *)":", remap, 0, TRUE, silent)
203 * used only after other typeahead has been processed.
206 ! put_reedit_in_typebuf()
211 * used only after other typeahead has been processed.
214 ! put_reedit_in_typebuf(silent)
221 buf[0] = restart_edit == 'I' ? 'i' : restart_edit;
224 ! if (ins_typebuf(buf, REMAP_NONE, 0, TRUE, FALSE) == OK)
230 ! put_in_typebuf(s, colon)
232 int colon; /* add ':' before the line */
236 ! put_reedit_in_typebuf();
238 ! retval = ins_typebuf((char_u *)"\n", REMAP_YES, 0, TRUE, FALSE);
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);
247 buf[0] = restart_edit == 'I' ? 'i' : restart_edit;
250 ! if (ins_typebuf(buf, REMAP_NONE, 0, TRUE, silent) == OK)
256 ! put_in_typebuf(s, colon, silent)
258 int colon; /* add ':' before the line */
263 ! put_reedit_in_typebuf(silent);
265 ! retval = ins_typebuf((char_u *)"\n", REMAP_YES, 0, TRUE, silent);
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);
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
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));
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
297 { /* Add new patch number below this line */
303 hundred-and-one symptoms of being an internet addict:
304 172. You join listservers just for the extra e-mail.
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 ///