comparison src/map.c @ 25431:634aed775408 v8.2.3252

patch 8.2.3252: duplicated code for adding buffer lines Commit: https://github.com/vim/vim/commit/4a15504e911bc90a29d862862f0b7a46d8acd12a Author: Yegappan Lakshmanan <yegappan@yahoo.com> Date: Fri Jul 30 21:32:45 2021 +0200 patch 8.2.3252: duplicated code for adding buffer lines 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)
author Bram Moolenaar <Bram@vim.org>
date Fri, 30 Jul 2021 21:45:02 +0200
parents 078edc1821bf
children 7d66d585bffa
comparison
equal deleted inserted replaced
25430:e9d147592cfc 25431:634aed775408
2182 } 2182 }
2183 2183
2184 return NULL; 2184 return NULL;
2185 } 2185 }
2186 2186
2187 void 2187 static void
2188 get_maparg(typval_T *argvars, typval_T *rettv, int exact) 2188 get_maparg(typval_T *argvars, typval_T *rettv, int exact)
2189 { 2189 {
2190 char_u *keys; 2190 char_u *keys;
2191 char_u *keys_simplified; 2191 char_u *keys_simplified;
2192 char_u *which; 2192 char_u *which;
2283 vim_free(mapmode); 2283 vim_free(mapmode);
2284 } 2284 }
2285 2285
2286 vim_free(keys_buf); 2286 vim_free(keys_buf);
2287 vim_free(alt_keys_buf); 2287 vim_free(alt_keys_buf);
2288 }
2289
2290 /*
2291 * "maparg()" function
2292 */
2293 void
2294 f_maparg(typval_T *argvars, typval_T *rettv)
2295 {
2296 if (in_vim9script()
2297 && (check_for_string_arg(argvars, 0) == FAIL
2298 || check_for_opt_string_arg(argvars, 1) == FAIL
2299 || (argvars[1].v_type != VAR_UNKNOWN
2300 && (check_for_opt_bool_arg(argvars, 2) == FAIL
2301 || (argvars[2].v_type != VAR_UNKNOWN
2302 && check_for_opt_bool_arg(argvars, 3) == FAIL)))))
2303 return;
2304
2305 get_maparg(argvars, rettv, TRUE);
2306 }
2307
2308 /*
2309 * "mapcheck()" function
2310 */
2311 void
2312 f_mapcheck(typval_T *argvars, typval_T *rettv)
2313 {
2314 if (in_vim9script()
2315 && (check_for_string_arg(argvars, 0) == FAIL
2316 || check_for_opt_string_arg(argvars, 1) == FAIL
2317 || (argvars[1].v_type != VAR_UNKNOWN
2318 && check_for_opt_bool_arg(argvars, 2) == FAIL)))
2319 return;
2320
2321 get_maparg(argvars, rettv, FALSE);
2288 } 2322 }
2289 2323
2290 /* 2324 /*
2291 * "mapset()" function 2325 * "mapset()" function
2292 */ 2326 */