aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/eval.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-06-23 21:17:11 +0800
committerGitHub <noreply@github.com>2022-06-23 21:17:11 +0800
commit7718b758461265d8966468c104ce5454538471e2 (patch)
treec58cec1a66defb6c84c113cb76c03e759db47feb /src/nvim/eval.c
parent05ca14a8810555495c309b8add3002773c77123d (diff)
downloadrneovim-7718b758461265d8966468c104ce5454538471e2.tar.gz
rneovim-7718b758461265d8966468c104ce5454538471e2.tar.bz2
rneovim-7718b758461265d8966468c104ce5454538471e2.zip
refactor: move some mapping-related code to a separate file (#19061)
This marks the following Vim patches as ported: vim-patch:8.1.1785: map functionality mixed with character input Problem: Map functionality mixed with character input. Solution: Move the map functionality to a separate file. (Yegappan Lakshmanan, closes vim/vim#4740) Graduate the +localmap feature. https://github.com/vim/vim/commit/b66bab381c8ba71fd6e92327d1d34c6f8a65f2a7 vim-patch:8.2.3643: header for source file is outdated Problem: Header for source file is outdated. Solution: Make the header more accurate. (closes vim/vim#9186) https://github.com/vim/vim/commit/a3f83feb63eae5464a620ae793c002eb45f7a838 Also cherry-pick a change for <unique> mappings from patch 8.2.0807. Rename map_clear_mode() to do_mapclear().
Diffstat (limited to 'src/nvim/eval.c')
-rw-r--r--src/nvim/eval.c51
1 files changed, 0 insertions, 51 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index 43d6ed558f..be2df9488e 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -6791,57 +6791,6 @@ char **tv_to_argv(typval_T *cmd_tv, const char **cmd, bool *executable)
return argv;
}
-/// Fill a dictionary with all applicable maparg() like dictionaries
-///
-/// @param dict The dictionary to be filled
-/// @param mp The maphash that contains the mapping information
-/// @param buffer_value The "buffer" value
-/// @param compatible True for compatible with old maparg() dict
-void mapblock_fill_dict(dict_T *const dict, const mapblock_T *const mp, long buffer_value,
- bool compatible)
- FUNC_ATTR_NONNULL_ALL
-{
- char *const lhs = str2special_save((const char *)mp->m_keys,
- compatible, !compatible);
- char *const mapmode = map_mode_to_chars(mp->m_mode);
- varnumber_T noremap_value;
-
- if (compatible) {
- // Keep old compatible behavior
- // This is unable to determine whether a mapping is a <script> mapping
- noremap_value = !!mp->m_noremap;
- } else {
- // Distinguish between <script> mapping
- // If it's not a <script> mapping, check if it's a noremap
- noremap_value = mp->m_noremap == REMAP_SCRIPT ? 2 : !!mp->m_noremap;
- }
-
- if (mp->m_luaref != LUA_NOREF) {
- tv_dict_add_nr(dict, S_LEN("callback"), mp->m_luaref);
- } else {
- 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,
- true));
- }
- }
- if (mp->m_desc != NULL) {
- tv_dict_add_allocated_str(dict, S_LEN("desc"), xstrdup(mp->m_desc));
- }
- 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("script"), mp->m_noremap == REMAP_SCRIPT ? 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("sid"), (varnumber_T)mp->m_script_ctx.sc_sid);
- tv_dict_add_nr(dict, S_LEN("lnum"), (varnumber_T)mp->m_script_ctx.sc_lnum);
- tv_dict_add_nr(dict, S_LEN("buffer"), (varnumber_T)buffer_value);
- tv_dict_add_nr(dict, S_LEN("nowait"), mp->m_nowait ? 1 : 0);
- tv_dict_add_allocated_str(dict, S_LEN("mode"), mapmode);
-}
-
void return_register(int regname, typval_T *rettv)
{
char buf[2] = { (char)regname, 0 };