aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/api/vim.c
diff options
context:
space:
mode:
authorThiago de Arruda <tpadilha84@gmail.com>2014-11-27 08:34:21 -0300
committerThiago de Arruda <tpadilha84@gmail.com>2014-11-27 08:34:33 -0300
commitf6c89ec70409badb7ca477de47dd1f8dbf3de376 (patch)
tree32844c9832b8f0fa7275b17e6d7c6908f22515c5 /src/nvim/api/vim.c
parenta6b7b924311eafd80f5983fdbea67842b0e169b4 (diff)
parent84eb118f62126c67092a6aa2585da51c824013d0 (diff)
downloadrneovim-f6c89ec70409badb7ca477de47dd1f8dbf3de376.tar.gz
rneovim-f6c89ec70409badb7ca477de47dd1f8dbf3de376.tar.bz2
rneovim-f6c89ec70409badb7ca477de47dd1f8dbf3de376.zip
Merge PR #1270 'Add Boolean argument escape_csi to vim_feedkeys'
Diffstat (limited to 'src/nvim/api/vim.c')
-rw-r--r--src/nvim/api/vim.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c
index addcbf62e9..fc1307090d 100644
--- a/src/nvim/api/vim.c
+++ b/src/nvim/api/vim.c
@@ -49,8 +49,10 @@ void vim_command(String str, Error *err)
///
/// @param keys to be typed
/// @param mode specifies the mapping options
+/// @param escape_csi the string needs escaping for K_SPECIAL/CSI bytes
/// @see feedkeys()
-void vim_feedkeys(String keys, String mode)
+/// @see vim_strsave_escape_csi
+void vim_feedkeys(String keys, String mode, Boolean escape_csi)
FUNC_ATTR_DEFERRED
{
bool remap = true;
@@ -68,12 +70,20 @@ void vim_feedkeys(String keys, String mode)
}
}
- /* Need to escape K_SPECIAL and CSI before putting the string in the
- * typeahead buffer. */
- char *keys_esc = (char *)vim_strsave_escape_csi((char_u *)keys.data);
+ char *keys_esc;
+ if (escape_csi) {
+ // Need to escape K_SPECIAL and CSI before putting the string in the
+ // typeahead buffer.
+ keys_esc = (char *)vim_strsave_escape_csi((char_u *)keys.data);
+ } else {
+ keys_esc = keys.data;
+ }
ins_typebuf((char_u *)keys_esc, (remap ? REMAP_YES : REMAP_NONE),
typebuf.tb_len, !typed, false);
- free(keys_esc);
+
+ if (escape_csi) {
+ free(keys_esc);
+ }
if (vgetc_busy)
typebuf_was_filled = true;