mirror of
https://github.com/neovim/neovim.git
synced 2025-09-17 00:38:17 +00:00
vim-patch:7.4.601 #1950
Problem: It is not possible to have feedkeys() insert characters. Solution: Add the 'i' flag. https://code.google.com/p/vim/source/detail?r=v7-4-601
This commit is contained in:
@@ -2959,9 +2959,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
|
||||||
@@ -2975,6 +2978,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()*
|
||||||
|
@@ -57,6 +57,7 @@ void vim_feedkeys(String keys, String mode, Boolean escape_csi)
|
|||||||
FUNC_ATTR_DEFERRED
|
FUNC_ATTR_DEFERRED
|
||||||
{
|
{
|
||||||
bool remap = true;
|
bool remap = true;
|
||||||
|
bool insert = false;
|
||||||
bool typed = false;
|
bool typed = false;
|
||||||
|
|
||||||
if (keys.size == 0) {
|
if (keys.size == 0) {
|
||||||
@@ -68,6 +69,7 @@ void vim_feedkeys(String keys, String mode, Boolean escape_csi)
|
|||||||
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,7 +82,7 @@ void vim_feedkeys(String keys, String mode, Boolean escape_csi)
|
|||||||
keys_esc = keys.data;
|
keys_esc = keys.data;
|
||||||
}
|
}
|
||||||
ins_typebuf((char_u *)keys_esc, (remap ? REMAP_YES : REMAP_NONE),
|
ins_typebuf((char_u *)keys_esc, (remap ? REMAP_YES : REMAP_NONE),
|
||||||
typebuf.tb_len, !typed, false);
|
insert ? 0 : typebuf.tb_len, !typed, false);
|
||||||
|
|
||||||
if (escape_csi) {
|
if (escape_csi) {
|
||||||
free(keys_esc);
|
free(keys_esc);
|
||||||
|
@@ -179,6 +179,35 @@ static char *(features[]) = {
|
|||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
static int included_patches[] = {
|
static int included_patches[] = {
|
||||||
|
//620,
|
||||||
|
//619,
|
||||||
|
//618,
|
||||||
|
//617,
|
||||||
|
//616,
|
||||||
|
//615,
|
||||||
|
//614,
|
||||||
|
//613,
|
||||||
|
//612,
|
||||||
|
//611,
|
||||||
|
//610,
|
||||||
|
//609,
|
||||||
|
//608,
|
||||||
|
//607,
|
||||||
|
//606,
|
||||||
|
//605,
|
||||||
|
//604,
|
||||||
|
//603,
|
||||||
|
//602,
|
||||||
|
601,
|
||||||
|
//600,
|
||||||
|
//599,
|
||||||
|
//598,
|
||||||
|
//597,
|
||||||
|
//596,
|
||||||
|
//595,
|
||||||
|
//594,
|
||||||
|
//593,
|
||||||
|
//592,
|
||||||
//591 NA
|
//591 NA
|
||||||
//590,
|
//590,
|
||||||
//589 NA
|
//589 NA
|
||||||
|
Reference in New Issue
Block a user