aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorZyX <kp-pav@yandex.ru>2017-07-02 19:15:14 +0300
committerZyX <kp-pav@yandex.ru>2017-07-02 19:15:14 +0300
commit936c070059f8c60085fa83fa7ea2ee4797d69f7b (patch)
tree07e43a0dd6fc43aeeaf5fe14fd96d401e7f00bc5 /src
parent85a6329a2b73924006eaccf8fd9ab59ec5c3ec46 (diff)
downloadrneovim-936c070059f8c60085fa83fa7ea2ee4797d69f7b.tar.gz
rneovim-936c070059f8c60085fa83fa7ea2ee4797d69f7b.tar.bz2
rneovim-936c070059f8c60085fa83fa7ea2ee4797d69f7b.zip
eval: Make nvim_get_keymap output more robust
Diffstat (limited to 'src')
-rw-r--r--src/nvim/eval.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index 32ba514d27..8ea0969dd5 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -12156,7 +12156,8 @@ void mapblock_fill_dict(dict_T *const dict,
bool compatible)
FUNC_ATTR_NONNULL_ALL
{
- char *const lhs = str2special_save((const char *)mp->m_keys, true);
+ char *const lhs = str2special_save((const char *)mp->m_keys,
+ compatible ? true : false);
char *const mapmode = map_mode_to_chars(mp->m_mode);
varnumber_T noremap_value;
@@ -12170,8 +12171,13 @@ void mapblock_fill_dict(dict_T *const dict,
noremap_value = mp->m_noremap == REMAP_SCRIPT ? 2 : !!mp->m_noremap;
}
+ if (compatible) {
+ tv_dict_add_str(dict, S_LEN("rhs"), (const char *)mp->m_orig_str);
+ } else {
+ tv_dict_add_allocated_str(dict, S_LEN("rhs"),
+ str2special_save((const char *)mp->m_str, false));
+ }
tv_dict_add_allocated_str(dict, S_LEN("lhs"), lhs);
- tv_dict_add_str(dict, S_LEN("rhs"), (const char *)mp->m_orig_str);
tv_dict_add_nr(dict, S_LEN("noremap"), noremap_value);
tv_dict_add_nr(dict, S_LEN("expr"), mp->m_expr ? 1 : 0);
tv_dict_add_nr(dict, S_LEN("silent"), mp->m_silent ? 1 : 0);