summaryrefslogtreecommitdiff
path: root/src/map.c
diff options
context:
space:
mode:
authorYegappan Lakshmanan <yegappan@yahoo.com>2021-07-30 21:32:45 +0200
committerBram Moolenaar <Bram@vim.org>2021-07-30 21:32:45 +0200
commit4a15504e911bc90a29d862862f0b7a46d8acd12a (patch)
treedb22db4ff9f4a48327a9f6c442b9e241bcebb2f9 /src/map.c
parent0f5575d0a7316a9c9a4b02df3372a07514cd8f26 (diff)
downloadvim-git-4a15504e911bc90a29d862862f0b7a46d8acd12a.tar.gz
patch 8.2.3252: duplicated code for adding buffer linesv8.2.3252
Problem: Duplicated code for adding buffer lines. Solution: Move code to a common function. Also move map functions to map.c. (Yegappan Lakshmanan, closes #8665)
Diffstat (limited to 'src/map.c')
-rw-r--r--src/map.c36
1 files changed, 35 insertions, 1 deletions
diff --git a/src/map.c b/src/map.c
index 09339a28c..47874008c 100644
--- a/src/map.c
+++ b/src/map.c
@@ -2184,7 +2184,7 @@ check_map(
return NULL;
}
- void
+ static void
get_maparg(typval_T *argvars, typval_T *rettv, int exact)
{
char_u *keys;
@@ -2288,6 +2288,40 @@ get_maparg(typval_T *argvars, typval_T *rettv, int exact)
}
/*
+ * "maparg()" function
+ */
+ void
+f_maparg(typval_T *argvars, typval_T *rettv)
+{
+ if (in_vim9script()
+ && (check_for_string_arg(argvars, 0) == FAIL
+ || check_for_opt_string_arg(argvars, 1) == FAIL
+ || (argvars[1].v_type != VAR_UNKNOWN
+ && (check_for_opt_bool_arg(argvars, 2) == FAIL
+ || (argvars[2].v_type != VAR_UNKNOWN
+ && check_for_opt_bool_arg(argvars, 3) == FAIL)))))
+ return;
+
+ get_maparg(argvars, rettv, TRUE);
+}
+
+/*
+ * "mapcheck()" function
+ */
+ void
+f_mapcheck(typval_T *argvars, typval_T *rettv)
+{
+ if (in_vim9script()
+ && (check_for_string_arg(argvars, 0) == FAIL
+ || check_for_opt_string_arg(argvars, 1) == FAIL
+ || (argvars[1].v_type != VAR_UNKNOWN
+ && check_for_opt_bool_arg(argvars, 2) == FAIL)))
+ return;
+
+ get_maparg(argvars, rettv, FALSE);
+}
+
+/*
* "mapset()" function
*/
void