Patch 8.2.1603
Problem:    Vim9: cannot use "true" with getchar().
Solution:   use tv_get_bool_chk(). (closes #6874)
Files:      src/getchar.c, src/testdir/test_vim9_func.vim


*** ../vim-8.2.1602/src/getchar.c       2020-08-05 22:07:22.495376371 +0200
--- src/getchar.c       2020-09-05 17:49:22.326890136 +0200
***************
*** 2037,2043 ****
        if (argvars[0].v_type == VAR_UNKNOWN)
            // getchar(): blocking wait.
            n = plain_vgetc();
!       else if (tv_get_number_chk(&argvars[0], &error) == 1)
            // getchar(1): only check if char avail
            n = vpeekc_any();
        else if (error || vpeekc_any() == NUL)
--- 2037,2043 ----
        if (argvars[0].v_type == VAR_UNKNOWN)
            // getchar(): blocking wait.
            n = plain_vgetc();
!       else if (tv_get_bool_chk(&argvars[0], &error))
            // getchar(1): only check if char avail
            n = vpeekc_any();
        else if (error || vpeekc_any() == NUL)
*** ../vim-8.2.1602/src/testdir/test_vim9_func.vim      2020-09-05 
17:37:00.845133066 +0200
--- src/testdir/test_vim9_func.vim      2020-09-05 17:48:42.075003739 +0200
***************
*** 1505,1510 ****
--- 1505,1514 ----
    bwipe Xtestfile1 Xtestfile2
  enddef
  
+ def Test_getchar()
+   assert_equal(0, getchar(true))
+ enddef
+ 
  def Fibonacci(n: number): number
    if n < 2
      return n
*** ../vim-8.2.1602/src/version.c       2020-09-05 17:37:00.845133066 +0200
--- src/version.c       2020-09-05 17:50:42.914664047 +0200
***************
*** 756,757 ****
--- 756,759 ----
  {   /* Add new patch number below this line */
+ /**/
+     1603,
  /**/

-- 
    f y cn rd ths thn y cn hv grt jb n cmptr prgrmmng

 /// 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/202009051551.085FptMo641901%40masaka.moolenaar.net.

Raspunde prin e-mail lui