Patch 8.2.1602
Problem:    Vim9: cannot use 'true" with getbufinfo().
Solution:   Use dict_get_bool(). (closes #6873)
Files:      src/evalbuffer.c, src/testdir/test_vim9_func.vim


*** ../vim-8.2.1601/src/evalbuffer.c    2020-09-04 18:35:23.544429716 +0200
--- src/evalbuffer.c    2020-09-05 17:36:18.125278095 +0200
***************
*** 624,644 ****
  
        if (sel_d != NULL)
        {
-           dictitem_T  *di;
- 
            filtered = TRUE;
! 
!           di = dict_find(sel_d, (char_u *)"buflisted", -1);
!           if (di != NULL && tv_get_number(&di->di_tv))
!               sel_buflisted = TRUE;
! 
!           di = dict_find(sel_d, (char_u *)"bufloaded", -1);
!           if (di != NULL && tv_get_number(&di->di_tv))
!               sel_bufloaded = TRUE;
! 
!           di = dict_find(sel_d, (char_u *)"bufmodified", -1);
!           if (di != NULL && tv_get_number(&di->di_tv))
!               sel_bufmodified = TRUE;
        }
      }
      else if (argvars[0].v_type != VAR_UNKNOWN)
--- 624,634 ----
  
        if (sel_d != NULL)
        {
            filtered = TRUE;
!           sel_buflisted = dict_get_bool(sel_d, (char_u *)"buflisted", FALSE);
!           sel_bufloaded = dict_get_bool(sel_d, (char_u *)"bufloaded", FALSE);
!           sel_bufmodified = dict_get_bool(sel_d, (char_u *)"bufmodified",
!                                                                       FALSE);
        }
      }
      else if (argvars[0].v_type != VAR_UNKNOWN)
*** ../vim-8.2.1601/src/testdir/test_vim9_func.vim      2020-09-05 
17:30:40.998542895 +0200
--- src/testdir/test_vim9_func.vim      2020-09-05 17:33:57.009778382 +0200
***************
*** 1493,1501 ****
    close
  enddef
  
! def Test_gebufinfo()
    let bufinfo = getbufinfo(bufnr())
    assert_equal(bufinfo, getbufinfo('%'))
  enddef
  
  def Fibonacci(n: number): number
--- 1493,1508 ----
    close
  enddef
  
! def Test_getbufinfo()
    let bufinfo = getbufinfo(bufnr())
    assert_equal(bufinfo, getbufinfo('%'))
+ 
+   edit Xtestfile1
+   hide edit Xtestfile2
+   hide enew
+   getbufinfo(#{bufloaded: true, buflisted: true, bufmodified: false})
+       ->len()->assert_equal(3)
+   bwipe Xtestfile1 Xtestfile2
  enddef
  
  def Fibonacci(n: number): number
*** ../vim-8.2.1601/src/version.c       2020-09-05 17:30:40.998542895 +0200
--- src/version.c       2020-09-05 17:34:54.901568844 +0200
***************
*** 756,757 ****
--- 756,759 ----
  {   /* Add new patch number below this line */
+ /**/
+     1602,
  /**/

-- 
    With sufficient thrust, pigs fly just fine.
                   -- RFC 1925

 /// 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/202009051537.085FbZ1J638876%40masaka.moolenaar.net.

Raspunde prin e-mail lui