Mercurial > vim
diff 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 |
line wrap: on
line diff
--- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -422,6 +422,21 @@ arg_string_or_list_any(type_T *type, typ } /* + * Check "type" is a string or a dict of 'any' + */ + static int +arg_string_or_dict_any(type_T *type, type_T *decl_type UNUSED, argcontext_T *context) +{ + if (type->tt_type == VAR_ANY + || type->tt_type == VAR_UNKNOWN + || type->tt_type == VAR_STRING + || type->tt_type == VAR_DICT) + return OK; + arg_type_mismatch(&t_string, type, context->arg_idx + 1); + return FAIL; +} + +/* * Check "type" is a string or a blob */ static int @@ -998,8 +1013,8 @@ static argcheck_T arg3_string[] = {arg_s static argcheck_T arg3_string_any_dict[] = {arg_string, NULL, arg_dict_any}; static argcheck_T arg3_string_any_string[] = {arg_string, NULL, arg_string}; static argcheck_T arg3_string_bool_bool[] = {arg_string, arg_bool, arg_bool}; -static argcheck_T arg3_string_bool_dict[] = {arg_string, arg_bool, arg_dict_any}; static argcheck_T arg3_string_number_bool[] = {arg_string, arg_number, arg_bool}; +static argcheck_T arg3_string_or_dict_bool_dict[] = {arg_string_or_dict_any, arg_bool, arg_dict_any}; static argcheck_T arg3_string_string_bool[] = {arg_string, arg_string, arg_bool}; static argcheck_T arg3_string_string_dict[] = {arg_string, arg_string, arg_dict_any}; static argcheck_T arg3_string_string_number[] = {arg_string, arg_string, arg_number}; @@ -2053,7 +2068,7 @@ static funcentry_T global_functions[] = ret_list_dict_any, f_maplist}, {"mapnew", 2, 2, FEARG_1, arg2_mapnew, ret_first_cont, f_mapnew}, - {"mapset", 3, 3, FEARG_1, arg3_string_bool_dict, + {"mapset", 1, 3, FEARG_1, arg3_string_or_dict_bool_dict, ret_void, f_mapset}, {"match", 2, 4, FEARG_1, arg24_match_func, ret_any, f_match},