Patch 8.2.1614
Problem:    Vim9: cannot pass "true" to searchcount().
Solution:   Use tv_get_bool_chk(). (closes #6854)
Files:      src/search.c, src/testdir/test_vim9_func.vim


*** ../vim-8.2.1613/src/search.c        2020-08-04 21:46:15.366707429 +0200
--- src/search.c        2020-09-05 21:15:09.794346384 +0200
***************
*** 4062,4068 ****
      char_u            *pattern = NULL;
      int                       maxcount = SEARCH_STAT_DEF_MAX_COUNT;
      long              timeout = SEARCH_STAT_DEF_TIMEOUT;
!     int                       recompute = TRUE;
      searchstat_T      stat;
  
      if (rettv_dict_alloc(rettv) == FAIL)
--- 4062,4068 ----
      char_u            *pattern = NULL;
      int                       maxcount = SEARCH_STAT_DEF_MAX_COUNT;
      long              timeout = SEARCH_STAT_DEF_TIMEOUT;
!     int                       recompute = FALSE;
      searchstat_T      stat;
  
      if (rettv_dict_alloc(rettv) == FAIL)
***************
*** 4098,4110 ****
            if (error)
                return;
        }
!       di = dict_find(dict, (char_u *)"recompute", -1);
!       if (di != NULL)
!       {
!           recompute = tv_get_number_chk(&di->di_tv, &error);
!           if (error)
!               return;
!       }
        di = dict_find(dict, (char_u *)"pattern", -1);
        if (di != NULL)
        {
--- 4098,4104 ----
            if (error)
                return;
        }
!       recompute = dict_get_bool(dict, (char_u *)"recompute", recompute);
        di = dict_find(dict, (char_u *)"pattern", -1);
        if (di != NULL)
        {
*** ../vim-8.2.1613/src/testdir/test_vim9_func.vim      2020-09-05 
20:29:35.748679383 +0200
--- src/testdir/test_vim9_func.vim      2020-09-05 21:17:30.530018684 +0200
***************
*** 1533,1538 ****
--- 1533,1552 ----
    assert_equal('a', nr2char(97, true))
  enddef
  
+ def Test_searchcount()
+   new
+   setline(1, "foo bar")
+   :/foo
+   assert_equal(#{
+       exact_match: 1,
+       current: 1,
+       total: 1,
+       maxcount: 99,
+       incomplete: 0,
+     }, searchcount(#{recompute: true}))
+   bwipe!
+ enddef
+ 
  def Fibonacci(n: number): number
    if n < 2
      return n
*** ../vim-8.2.1613/src/version.c       2020-09-05 20:59:55.108468975 +0200
--- src/version.c       2020-09-05 21:20:46.977560976 +0200
***************
*** 756,757 ****
--- 756,759 ----
  {   /* Add new patch number below this line */
+ /**/
+     1614,
  /**/

-- 
LAUNCELOT: I am, sir. I am a Knight of King Arthur.
FATHER:    'Mm ... very nice castle, Camelot ... very good pig country....
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// 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/202009051921.085JLiVJ695231%40masaka.moolenaar.net.

Raspunde prin e-mail lui