mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 8.2.1751: using 2 where bool is expected may throw an error
Problem: Using 2 where bool is expected may throw an error. Solution: Make this backwards compatible.
This commit is contained in:
parent
3697c9bbae
commit
bade44e5ca
@ -1982,7 +1982,7 @@ f_deepcopy(typval_T *argvars, typval_T *rettv)
|
|||||||
if (argvars[1].v_type != VAR_UNKNOWN)
|
if (argvars[1].v_type != VAR_UNKNOWN)
|
||||||
noref = (int)tv_get_bool_chk(&argvars[1], NULL);
|
noref = (int)tv_get_bool_chk(&argvars[1], NULL);
|
||||||
if (noref < 0 || noref > 1)
|
if (noref < 0 || noref > 1)
|
||||||
emsg(_(e_invarg));
|
semsg(_(e_using_number_as_bool_nr), noref);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
copyID = get_copyID();
|
copyID = get_copyID();
|
||||||
@ -8193,7 +8193,7 @@ f_strchars(typval_T *argvars, typval_T *rettv)
|
|||||||
if (argvars[1].v_type != VAR_UNKNOWN)
|
if (argvars[1].v_type != VAR_UNKNOWN)
|
||||||
skipcc = (int)tv_get_bool(&argvars[1]);
|
skipcc = (int)tv_get_bool(&argvars[1]);
|
||||||
if (skipcc < 0 || skipcc > 1)
|
if (skipcc < 0 || skipcc > 1)
|
||||||
emsg(_(e_invarg));
|
semsg(_(e_using_number_as_bool_nr), skipcc);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
func_mb_ptr2char_adv = skipcc ? mb_ptr2char_adv : mb_cptr2char_adv;
|
func_mb_ptr2char_adv = skipcc ? mb_ptr2char_adv : mb_cptr2char_adv;
|
||||||
|
@ -290,6 +290,9 @@ func Test_searchpair()
|
|||||||
new
|
new
|
||||||
call setline(1, ['other code', 'here [', ' [', ' " cursor here', ' ]]'])
|
call setline(1, ['other code', 'here [', ' [', ' " cursor here', ' ]]'])
|
||||||
|
|
||||||
|
" should not give an error for using "42"
|
||||||
|
call assert_equal(0, searchpair('a', 'b', 'c', '', 42))
|
||||||
|
|
||||||
4
|
4
|
||||||
call assert_equal(3, searchpair('\[', '', ']', 'bW'))
|
call assert_equal(3, searchpair('\[', '', ']', 'bW'))
|
||||||
call assert_equal([0, 3, 2, 0], getpos('.'))
|
call assert_equal([0, 3, 2, 0], getpos('.'))
|
||||||
|
@ -560,8 +560,8 @@ func Test_term_gettty()
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
call assert_fails('call term_gettty(buf, 2)', 'E1023:')
|
call assert_fails('call term_gettty(buf, 2)', 'E475:')
|
||||||
call assert_fails('call term_gettty(buf, -1)', 'E1023:')
|
call assert_fails('call term_gettty(buf, -1)', 'E475:')
|
||||||
|
|
||||||
call assert_equal('', term_gettty(buf + 1))
|
call assert_equal('', term_gettty(buf + 1))
|
||||||
|
|
||||||
|
@ -177,7 +177,7 @@ tv_get_bool_or_number_chk(typval_T *varp, int *denote, int want_bool)
|
|||||||
switch (varp->v_type)
|
switch (varp->v_type)
|
||||||
{
|
{
|
||||||
case VAR_NUMBER:
|
case VAR_NUMBER:
|
||||||
if (want_bool && varp->vval.v_number != 0
|
if (in_vim9script() && want_bool && varp->vval.v_number != 0
|
||||||
&& varp->vval.v_number != 1)
|
&& varp->vval.v_number != 1)
|
||||||
{
|
{
|
||||||
semsg(_(e_using_number_as_bool_nr), varp->vval.v_number);
|
semsg(_(e_using_number_as_bool_nr), varp->vval.v_number);
|
||||||
|
@ -750,6 +750,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1751,
|
||||||
/**/
|
/**/
|
||||||
1750,
|
1750,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user