mirror of
https://github.com/neovim/neovim.git
synced 2025-09-14 07:18:17 +00:00
eval: Make nvim_get_keymap output more robust
This commit is contained in:
@@ -12156,7 +12156,8 @@ void mapblock_fill_dict(dict_T *const dict,
|
|||||||
bool compatible)
|
bool compatible)
|
||||||
FUNC_ATTR_NONNULL_ALL
|
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);
|
char *const mapmode = map_mode_to_chars(mp->m_mode);
|
||||||
varnumber_T noremap_value;
|
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;
|
noremap_value = mp->m_noremap == REMAP_SCRIPT ? 2 : !!mp->m_noremap;
|
||||||
}
|
}
|
||||||
|
|
||||||
tv_dict_add_allocated_str(dict, S_LEN("lhs"), lhs);
|
if (compatible) {
|
||||||
tv_dict_add_str(dict, S_LEN("rhs"), (const char *)mp->m_orig_str);
|
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_nr(dict, S_LEN("noremap"), noremap_value);
|
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("expr"), mp->m_expr ? 1 : 0);
|
||||||
tv_dict_add_nr(dict, S_LEN("silent"), mp->m_silent ? 1 : 0);
|
tv_dict_add_nr(dict, S_LEN("silent"), mp->m_silent ? 1 : 0);
|
||||||
|
Reference in New Issue
Block a user