mirror of
https://github.com/vim/vim.git
synced 2025-09-23 03:43:49 -04:00
patch 8.2.1603: Vim9: cannot use "true" with getchar()
Problem: Vim9: cannot use "true" with getchar(). Solution: use tv_get_bool_chk(). (closes #6874)
This commit is contained in:
@@ -2037,7 +2037,7 @@ f_getchar(typval_T *argvars, typval_T *rettv)
|
|||||||
if (argvars[0].v_type == VAR_UNKNOWN)
|
if (argvars[0].v_type == VAR_UNKNOWN)
|
||||||
// getchar(): blocking wait.
|
// getchar(): blocking wait.
|
||||||
n = plain_vgetc();
|
n = plain_vgetc();
|
||||||
else if (tv_get_number_chk(&argvars[0], &error) == 1)
|
else if (tv_get_bool_chk(&argvars[0], &error))
|
||||||
// getchar(1): only check if char avail
|
// getchar(1): only check if char avail
|
||||||
n = vpeekc_any();
|
n = vpeekc_any();
|
||||||
else if (error || vpeekc_any() == NUL)
|
else if (error || vpeekc_any() == NUL)
|
||||||
|
@@ -1505,6 +1505,10 @@ def Test_getbufinfo()
|
|||||||
bwipe Xtestfile1 Xtestfile2
|
bwipe Xtestfile1 Xtestfile2
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
|
def Test_getchar()
|
||||||
|
assert_equal(0, getchar(true))
|
||||||
|
enddef
|
||||||
|
|
||||||
def Fibonacci(n: number): number
|
def Fibonacci(n: number): number
|
||||||
if n < 2
|
if n < 2
|
||||||
return n
|
return n
|
||||||
|
@@ -754,6 +754,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 */
|
||||||
|
/**/
|
||||||
|
1603,
|
||||||
/**/
|
/**/
|
||||||
1602,
|
1602,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user