aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/eval.c
diff options
context:
space:
mode:
authorThiago de Arruda <tpadilha84@gmail.com>2014-08-07 12:03:36 -0300
committerThiago de Arruda <tpadilha84@gmail.com>2014-08-07 12:03:48 -0300
commit69497ad10a2b2231f2dc317b97124b9ec080a4d4 (patch)
tree06c30e6459f2b874a98a0147c41cad4804d59fd6 /src/nvim/eval.c
parent4702b8a71636266cef8cc4fadc32f785d4eea962 (diff)
parent2875ad865b5c48103642a65728d984ceee75ed65 (diff)
downloadrneovim-69497ad10a2b2231f2dc317b97124b9ec080a4d4.tar.gz
rneovim-69497ad10a2b2231f2dc317b97124b9ec080a4d4.tar.bz2
rneovim-69497ad10a2b2231f2dc317b97124b9ec080a4d4.zip
Merge pull request #920 'Add `feedkeys` API function part 2'
Diffstat (limited to 'src/nvim/eval.c')
-rw-r--r--src/nvim/eval.c24
1 files changed, 4 insertions, 20 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index f7b65d1476..af41893035 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -83,7 +83,7 @@
#include "nvim/os/time.h"
#include "nvim/os/channel.h"
#include "nvim/api/private/helpers.h"
-#include "nvim/api/private/defs.h"
+#include "nvim/api/vim.h"
#include "nvim/os/msgpack_rpc_helpers.h"
#include "nvim/os/dl.h"
#include "nvim/os/provider.h"
@@ -8280,11 +8280,8 @@ static void f_extend(typval_T *argvars, typval_T *rettv)
*/
static void f_feedkeys(typval_T *argvars, typval_T *rettv)
{
- int remap = TRUE;
- char_u *keys, *flags;
+ char_u *keys, *flags = NULL;
char_u nbuf[NUMBUFLEN];
- int typed = FALSE;
- char_u *keys_esc;
/* This is not allowed in the sandbox. If the commands would still be
* executed in the sandbox it would be OK, but it probably happens later,
@@ -8296,23 +8293,10 @@ static void f_feedkeys(typval_T *argvars, typval_T *rettv)
if (*keys != NUL) {
if (argvars[1].v_type != VAR_UNKNOWN) {
flags = get_tv_string_buf(&argvars[1], nbuf);
- for (; *flags != NUL; ++flags) {
- switch (*flags) {
- case 'n': remap = FALSE; break;
- case 'm': remap = TRUE; break;
- case 't': typed = TRUE; break;
- }
- }
}
- /* Need to escape K_SPECIAL and CSI before putting the string in the
- * typeahead buffer. */
- keys_esc = vim_strsave_escape_csi(keys);
- ins_typebuf(keys_esc, (remap ? REMAP_YES : REMAP_NONE),
- typebuf.tb_len, !typed, FALSE);
- free(keys_esc);
- if (vgetc_busy)
- typebuf_was_filled = TRUE;
+ vim_feedkeys(cstr_as_string((char *)keys),
+ cstr_as_string((char *)flags));
}
}