comparison src/evalfunc.c @ 28674:38f7a132bba3 v8.2.4861

patch 8.2.4861: it is not easy to restore saved mappings Commit: https://github.com/vim/vim/commit/51d04d16f21e19d6eded98f9530d84089102f925 Author: Ernie Rael <errael@raelity.com> Date: Wed May 4 15:40:22 2022 +0100 patch 8.2.4861: it is not easy to restore saved mappings Problem: It is not easy to restore saved mappings. Solution: Make mapset() accept a dict argument. (Ernie Rael, closes https://github.com/vim/vim/issues/10295)
author Bram Moolenaar <Bram@vim.org>
date Wed, 04 May 2022 16:45:03 +0200
parents dfe18756f2ad
children bfd8e25fa207
comparison
equal deleted inserted replaced
28673:1bb2e8f5cc4b 28674:38f7a132bba3
414 { 414 {
415 if (type->tt_type == VAR_ANY 415 if (type->tt_type == VAR_ANY
416 || type->tt_type == VAR_UNKNOWN 416 || type->tt_type == VAR_UNKNOWN
417 || type->tt_type == VAR_STRING 417 || type->tt_type == VAR_STRING
418 || type->tt_type == VAR_LIST) 418 || type->tt_type == VAR_LIST)
419 return OK;
420 arg_type_mismatch(&t_string, type, context->arg_idx + 1);
421 return FAIL;
422 }
423
424 /*
425 * Check "type" is a string or a dict of 'any'
426 */
427 static int
428 arg_string_or_dict_any(type_T *type, type_T *decl_type UNUSED, argcontext_T *context)
429 {
430 if (type->tt_type == VAR_ANY
431 || type->tt_type == VAR_UNKNOWN
432 || type->tt_type == VAR_STRING
433 || type->tt_type == VAR_DICT)
419 return OK; 434 return OK;
420 arg_type_mismatch(&t_string, type, context->arg_idx + 1); 435 arg_type_mismatch(&t_string, type, context->arg_idx + 1);
421 return FAIL; 436 return FAIL;
422 } 437 }
423 438
996 static argcheck_T arg3_number_string_string[] = {arg_number, arg_string, arg_string}; 1011 static argcheck_T arg3_number_string_string[] = {arg_number, arg_string, arg_string};
997 static argcheck_T arg3_string[] = {arg_string, arg_string, arg_string}; 1012 static argcheck_T arg3_string[] = {arg_string, arg_string, arg_string};
998 static argcheck_T arg3_string_any_dict[] = {arg_string, NULL, arg_dict_any}; 1013 static argcheck_T arg3_string_any_dict[] = {arg_string, NULL, arg_dict_any};
999 static argcheck_T arg3_string_any_string[] = {arg_string, NULL, arg_string}; 1014 static argcheck_T arg3_string_any_string[] = {arg_string, NULL, arg_string};
1000 static argcheck_T arg3_string_bool_bool[] = {arg_string, arg_bool, arg_bool}; 1015 static argcheck_T arg3_string_bool_bool[] = {arg_string, arg_bool, arg_bool};
1001 static argcheck_T arg3_string_bool_dict[] = {arg_string, arg_bool, arg_dict_any};
1002 static argcheck_T arg3_string_number_bool[] = {arg_string, arg_number, arg_bool}; 1016 static argcheck_T arg3_string_number_bool[] = {arg_string, arg_number, arg_bool};
1017 static argcheck_T arg3_string_or_dict_bool_dict[] = {arg_string_or_dict_any, arg_bool, arg_dict_any};
1003 static argcheck_T arg3_string_string_bool[] = {arg_string, arg_string, arg_bool}; 1018 static argcheck_T arg3_string_string_bool[] = {arg_string, arg_string, arg_bool};
1004 static argcheck_T arg3_string_string_dict[] = {arg_string, arg_string, arg_dict_any}; 1019 static argcheck_T arg3_string_string_dict[] = {arg_string, arg_string, arg_dict_any};
1005 static argcheck_T arg3_string_string_number[] = {arg_string, arg_string, arg_number}; 1020 static argcheck_T arg3_string_string_number[] = {arg_string, arg_string, arg_number};
1006 static argcheck_T arg4_number_number_string_any[] = {arg_number, arg_number, arg_string, NULL}; 1021 static argcheck_T arg4_number_number_string_any[] = {arg_number, arg_number, arg_string, NULL};
1007 static argcheck_T arg4_string_string_any_string[] = {arg_string, arg_string, NULL, arg_string}; 1022 static argcheck_T arg4_string_string_any_string[] = {arg_string, arg_string, NULL, arg_string};
2051 ret_string, f_mapcheck}, 2066 ret_string, f_mapcheck},
2052 {"maplist", 0, 1, 0, arg1_bool, 2067 {"maplist", 0, 1, 0, arg1_bool,
2053 ret_list_dict_any, f_maplist}, 2068 ret_list_dict_any, f_maplist},
2054 {"mapnew", 2, 2, FEARG_1, arg2_mapnew, 2069 {"mapnew", 2, 2, FEARG_1, arg2_mapnew,
2055 ret_first_cont, f_mapnew}, 2070 ret_first_cont, f_mapnew},
2056 {"mapset", 3, 3, FEARG_1, arg3_string_bool_dict, 2071 {"mapset", 1, 3, FEARG_1, arg3_string_or_dict_bool_dict,
2057 ret_void, f_mapset}, 2072 ret_void, f_mapset},
2058 {"match", 2, 4, FEARG_1, arg24_match_func, 2073 {"match", 2, 4, FEARG_1, arg24_match_func,
2059 ret_any, f_match}, 2074 ret_any, f_match},
2060 {"matchadd", 2, 5, FEARG_1, arg25_matchadd, 2075 {"matchadd", 2, 5, FEARG_1, arg25_matchadd,
2061 ret_number, f_matchadd}, 2076 ret_number, f_matchadd},