0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

updated for version 7.4.601

Problem:    It is not possible to have feedkeys() insert characters.
Solution:   Add the 'i' flag.
This commit is contained in:
Bram Moolenaar
2015-01-27 15:19:24 +01:00
parent 0cd040b96a
commit 0a988df731
3 changed files with 13 additions and 5 deletions

View File

@@ -1,4 +1,4 @@
*eval.txt* For Vim version 7.4. Last change: 2014 Dec 07 *eval.txt* For Vim version 7.4. Last change: 2015 Jan 27
VIM REFERENCE MANUAL by Bram Moolenaar VIM REFERENCE MANUAL by Bram Moolenaar
@@ -2965,9 +2965,12 @@ extend({expr1}, {expr2} [, {expr3}]) *extend()*
feedkeys({string} [, {mode}]) *feedkeys()* feedkeys({string} [, {mode}]) *feedkeys()*
Characters in {string} are queued for processing as if they Characters in {string} are queued for processing as if they
come from a mapping or were typed by the user. They are added come from a mapping or were typed by the user.
to the end of the typeahead buffer, thus if a mapping is still By default the string is added to the end of the typeahead
being executed these characters come after them. buffer, thus if a mapping is still being executed the
characters come after them. Use the 'i' flag to insert before
other characters, they will be executed next, before any
characters from a mapping.
The function does not wait for processing of keys contained in The function does not wait for processing of keys contained in
{string}. {string}.
To include special keys into {string}, use double-quotes To include special keys into {string}, use double-quotes
@@ -2981,6 +2984,7 @@ feedkeys({string} [, {mode}]) *feedkeys()*
't' Handle keys as if typed; otherwise they are handled as 't' Handle keys as if typed; otherwise they are handled as
if coming from a mapping. This matters for undo, if coming from a mapping. This matters for undo,
opening folds, etc. opening folds, etc.
'i' Insert the string instead of appending (see above).
Return value is always 0. Return value is always 0.
filereadable({file}) *filereadable()* filereadable({file}) *filereadable()*

View File

@@ -10500,6 +10500,7 @@ f_feedkeys(argvars, rettv)
typval_T *rettv UNUSED; typval_T *rettv UNUSED;
{ {
int remap = TRUE; int remap = TRUE;
int insert = FALSE;
char_u *keys, *flags; char_u *keys, *flags;
char_u nbuf[NUMBUFLEN]; char_u nbuf[NUMBUFLEN];
int typed = FALSE; int typed = FALSE;
@@ -10524,6 +10525,7 @@ f_feedkeys(argvars, rettv)
case 'n': remap = FALSE; break; case 'n': remap = FALSE; break;
case 'm': remap = TRUE; break; case 'm': remap = TRUE; break;
case 't': typed = TRUE; break; case 't': typed = TRUE; break;
case 'i': insert = TRUE; break;
} }
} }
} }
@@ -10534,7 +10536,7 @@ f_feedkeys(argvars, rettv)
if (keys_esc != NULL) if (keys_esc != NULL)
{ {
ins_typebuf(keys_esc, (remap ? REMAP_YES : REMAP_NONE), ins_typebuf(keys_esc, (remap ? REMAP_YES : REMAP_NONE),
typebuf.tb_len, !typed, FALSE); insert ? 0 : typebuf.tb_len, !typed, FALSE);
vim_free(keys_esc); vim_free(keys_esc);
if (vgetc_busy) if (vgetc_busy)
typebuf_was_filled = TRUE; typebuf_was_filled = TRUE;

View File

@@ -741,6 +741,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
601,
/**/ /**/
600, 600,
/**/ /**/