aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/api/vim.c
diff options
context:
space:
mode:
authorThiago de Arruda <tpadilha84@gmail.com>2014-10-29 23:43:35 -0300
committerThiago de Arruda <tpadilha84@gmail.com>2014-10-29 23:43:35 -0300
commit713c3ae5aeaf081b041769a18f264e3e52ee0b8a (patch)
tree6d166d720d8f9d2969d9fd1e4ab951cf7622c9c6 /src/nvim/api/vim.c
parent49d5ed55914b5af32abcb87b6b422f880dc1d0d0 (diff)
parent9e41dd07e4f25b7c02975e47fdf0dac65bc08e41 (diff)
downloadrneovim-713c3ae5aeaf081b041769a18f264e3e52ee0b8a.tar.gz
rneovim-713c3ae5aeaf081b041769a18f264e3e52ee0b8a.tar.bz2
rneovim-713c3ae5aeaf081b041769a18f264e3e52ee0b8a.zip
Merge PR #1357 'Fixes to input/job modules'
Diffstat (limited to 'src/nvim/api/vim.c')
-rw-r--r--src/nvim/api/vim.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c
index 9afefd6fa3..b6bac1588a 100644
--- a/src/nvim/api/vim.c
+++ b/src/nvim/api/vim.c
@@ -24,6 +24,7 @@
#include "nvim/misc2.h"
#include "nvim/term.h"
#include "nvim/getchar.h"
+#include "nvim/os/input.h"
#define LINE_BUFFER_SIZE 4096
@@ -51,6 +52,7 @@ void vim_command(String str, Error *err)
/// @param mode specifies the mapping options
/// @see feedkeys()
void vim_feedkeys(String keys, String mode)
+ FUNC_ATTR_DEFERRED
{
bool remap = true;
bool typed = false;
@@ -78,6 +80,18 @@ void vim_feedkeys(String keys, String mode)
typebuf_was_filled = true;
}
+/// Pass input keys to Neovim. Unlike `vim_feedkeys`, this will use a
+/// lower-level input buffer and the call is not deferred.
+/// This is the most reliable way to emulate real user input.
+///
+/// @param keys to be typed
+/// @return The number bytes actually written, which can be lower than
+/// requested if the buffer becomes full.
+Integer vim_input(String keys)
+{
+ return (Integer)input_enqueue(keys);
+}
+
/// Replace any terminal codes with the internal representation
///
/// @see replace_termcodes