diff options
author | Thiago de Arruda <tpadilha84@gmail.com> | 2014-10-29 23:06:18 -0300 |
---|---|---|
committer | Thiago de Arruda <tpadilha84@gmail.com> | 2014-10-29 23:33:10 -0300 |
commit | 3800b24c5abecfb9d1ed1d5d36ddcd5a31a45609 (patch) | |
tree | ffeddd33831cea86a0feb6eb521a1da36c302891 /src/nvim/os/input.c | |
parent | 94527245a5749b50c20cb057cc53ea4b1b2c624f (diff) | |
download | rneovim-3800b24c5abecfb9d1ed1d5d36ddcd5a31a45609.tar.gz rneovim-3800b24c5abecfb9d1ed1d5d36ddcd5a31a45609.tar.bz2 rneovim-3800b24c5abecfb9d1ed1d5d36ddcd5a31a45609.zip |
api: Add vim_input function and mark vim_feedkeys as deferred
The `vim_feedkeys` must be deferred because it can potentially free the buffer
passed to `os_inchar`(which in turns calls `vim_feedkeys` indirectly).
The new `vim_input` function can be used to emulate user input(Since it does not
mess with the typeahead, it is safe to execute without deferring).
Diffstat (limited to 'src/nvim/os/input.c')
-rw-r--r-- | src/nvim/os/input.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/nvim/os/input.c b/src/nvim/os/input.c index 1b1a681a8b..d948a48b64 100644 --- a/src/nvim/os/input.c +++ b/src/nvim/os/input.c @@ -165,6 +165,13 @@ void input_buffer_restore(String str) free(str.data); } +size_t input_enqueue(String keys) +{ + size_t rv = rbuffer_write(input_buffer, keys.data, keys.size); + process_interrupts(); + return rv; +} + static bool input_poll(int ms) { event_poll_until(ms, input_ready()); |