Mercurial > vim
changeset 22468:990b47e15cd7 v8.2.1782
patch 8.2.1782: Vim9: cannot pass boolean to mapset()
Commit: https://github.com/vim/vim/commit/74273e66914e46eb5814c13a1b888e45358859b6
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Oct 1 21:37:21 2020 +0200
patch 8.2.1782: Vim9: cannot pass boolean to mapset()
Problem: Vim9: cannot pass boolean to mapset().
Solution: Use get_tv_bool(). (closes https://github.com/vim/vim/issues/7041)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 01 Oct 2020 21:45:03 +0200 |
parents | e841e4b7ef2a |
children | fd9b84013893 |
files | src/map.c src/testdir/test_vim9_func.vim src/version.c |
diffstat | 3 files changed, 11 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/map.c +++ b/src/map.c @@ -2307,7 +2307,7 @@ f_mapset(typval_T *argvars, typval_T *re if (which == NULL) return; mode = get_map_mode(&which, 0); - is_abbr = (int)tv_get_number(&argvars[1]); + is_abbr = (int)tv_get_bool(&argvars[1]); if (argvars[2].v_type != VAR_DICT) {
--- a/src/testdir/test_vim9_func.vim +++ b/src/testdir/test_vim9_func.vim @@ -1721,6 +1721,14 @@ def Test_mapcheck() iunabbrev foo enddef +def Test_maparg_mapset() + nnoremap <F3> :echo "hit F3"<CR> + var mapsave = maparg('<F3>', 'n', false, true) + mapset('n', false, mapsave) + + nunmap <F3> +enddef + def Test_nr2char() nr2char(97, true)->assert_equal('a') enddef