Patch 8.2.1577
Problem: Vim9: hasmapto(), mapcheck() and maparg() do not take "true" as
argument.
Solution: Use tv_get_bool(). (closes #6822, closes #6824)
Files: src/evalfunc.c, src/map.c, src/testdir/test_vim9_func.vim
*** ../vim-8.2.1576/src/evalfunc.c 2020-09-02 22:10:30.716174595 +0200
--- src/evalfunc.c 2020-09-02 22:13:41.723632674 +0200
***************
*** 4808,4814 ****
{
mode = tv_get_string_buf(&argvars[1], buf);
if (argvars[2].v_type != VAR_UNKNOWN)
! abbr = (int)tv_get_number(&argvars[2]);
}
if (map_to_exists(name, mode, abbr))
--- 4808,4814 ----
{
mode = tv_get_string_buf(&argvars[1], buf);
if (argvars[2].v_type != VAR_UNKNOWN)
! abbr = (int)tv_get_bool(&argvars[2]);
}
if (map_to_exists(name, mode, abbr))
*** ../vim-8.2.1576/src/map.c 2020-08-30 19:26:40.736556825 +0200
--- src/map.c 2020-09-02 22:17:48.650929779 +0200
***************
*** 2204,2212 ****
which = tv_get_string_buf_chk(&argvars[1], buf);
if (argvars[2].v_type != VAR_UNKNOWN)
{
! abbr = (int)tv_get_number(&argvars[2]);
if (argvars[3].v_type != VAR_UNKNOWN)
! get_dict = (int)tv_get_number(&argvars[3]);
}
}
else
--- 2204,2212 ----
which = tv_get_string_buf_chk(&argvars[1], buf);
if (argvars[2].v_type != VAR_UNKNOWN)
{
! abbr = (int)tv_get_bool(&argvars[2]);
if (argvars[3].v_type != VAR_UNKNOWN)
! get_dict = (int)tv_get_bool(&argvars[3]);
}
}
else
*** ../vim-8.2.1576/src/testdir/test_vim9_func.vim 2020-09-02
22:10:30.716174595 +0200
--- src/testdir/test_vim9_func.vim 2020-09-02 22:21:08.454359889 +0200
***************
*** 1521,1526 ****
--- 1521,1565 ----
assert_equal(['./runtest.vim'], globpath('.', 'runtest.vim', true, true,
true))
enddef
+ def Test_hasmapto()
+ assert_equal(0, hasmapto('foobar', 'i', true))
+ iabbrev foo foobar
+ assert_equal(1, hasmapto('foobar', 'i', true))
+ iunabbrev foo
+ enddef
+
+ def SID(): number
+ return expand('<SID>')
+ ->matchstr('<SNR>\zs\d\+\ze_$')
+ ->str2nr()
+ enddef
+
+ def Test_maparg()
+ let lnum = str2nr(expand('<sflnum>'))
+ map foo bar
+ assert_equal(#{
+ lnum: lnum + 1,
+ script: 0,
+ mode: ' ',
+ silent: 0,
+ noremap: 0,
+ lhs: 'foo',
+ lhsraw: 'foo',
+ nowait: 0,
+ expr: 0,
+ sid: SID(),
+ rhs: 'bar',
+ buffer: 0},
+ maparg('foo', '', false, true))
+ unmap foo
+ enddef
+
+ def Test_mapcheck()
+ iabbrev foo foobar
+ assert_equal('foobar', mapcheck('foo', 'i', true))
+ iunabbrev foo
+ enddef
+
def Test_recursive_call()
assert_equal(6765, Fibonacci(20))
enddef
*** ../vim-8.2.1576/src/version.c 2020-09-02 22:10:30.716174595 +0200
--- src/version.c 2020-09-02 22:23:31.289952088 +0200
***************
*** 756,757 ****
--- 756,759 ----
{ /* Add new patch number below this line */
+ /**/
+ 1577,
/**/
--
MORTICIAN: Bring out your dead!
[clang]
Bring out your dead!
[clang]
Bring out your dead!
CUSTOMER: Here's one -- nine pence.
DEAD PERSON: I'm not dead!
The Quest for the Holy Grail (Monty Python)
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/202009022026.082KQ5vp3695058%40masaka.moolenaar.net.