Patch 8.2.1627
Problem:    Vim9: cannot pass "true" to submatch(), term_gettty() and
            term_start()
Solution:   Use tv_get_bool_chk(). (closes #6888, closes #6890, closes #6889)
Files:      src/evalfunc.c, src/terminal.c, src/job.c,
            src/testdir/test_vim9_func.vim


*** ../vim-8.2.1626/src/evalfunc.c      2020-09-06 16:09:01.233599196 +0200
--- src/evalfunc.c      2020-09-06 17:29:45.734993791 +0200
***************
*** 8400,8406 ****
        return;
      }
      if (argvars[1].v_type != VAR_UNKNOWN)
!       retList = (int)tv_get_number_chk(&argvars[1], &error);
      if (error)
        return;
  
--- 8400,8406 ----
        return;
      }
      if (argvars[1].v_type != VAR_UNKNOWN)
!       retList = (int)tv_get_bool_chk(&argvars[1], &error);
      if (error)
        return;
  
*** ../vim-8.2.1626/src/terminal.c      2020-09-05 16:08:46.594237023 +0200
--- src/terminal.c      2020-09-06 17:56:21.166526315 +0200
***************
*** 5768,5774 ****
      if (buf == NULL)
        return;
      if (argvars[1].v_type != VAR_UNKNOWN)
!       num = tv_get_number(&argvars[1]);
  
      switch (num)
      {
--- 5768,5774 ----
      if (buf == NULL)
        return;
      if (argvars[1].v_type != VAR_UNKNOWN)
!       num = tv_get_bool(&argvars[1]);
  
      switch (num)
      {
*** ../vim-8.2.1626/src/job.c   2020-09-05 15:48:32.469546692 +0200
--- src/job.c   2020-09-06 18:20:28.085884624 +0200
***************
*** 448,454 ****
                if (!(supported2 & JO2_CURWIN))
                    break;
                opt->jo_set2 |= JO2_CURWIN;
!               opt->jo_curwin = tv_get_number(item);
            }
            else if (STRCMP(hi->hi_key, "bufnr") == 0)
            {
--- 448,454 ----
                if (!(supported2 & JO2_CURWIN))
                    break;
                opt->jo_set2 |= JO2_CURWIN;
!               opt->jo_curwin = tv_get_bool(item);
            }
            else if (STRCMP(hi->hi_key, "bufnr") == 0)
            {
*** ../vim-8.2.1626/src/testdir/test_vim9_func.vim      2020-09-06 
16:09:01.233599196 +0200
--- src/testdir/test_vim9_func.vim      2020-09-06 18:18:41.614180564 +0200
***************
*** 1,6 ****
--- 1,7 ----
  " Test various aspects of the Vim9 script language.
  
  source check.vim
+ source term_util.vim
  source view_util.vim
  source vim9.vim
  source screendump.vim
***************
*** 1648,1653 ****
--- 1649,1662 ----
    strchars("A\u20dd", true)->assert_equal(1)
  enddef
  
+ def Test_submatch()
+   let pat = 'A\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)'
+   let Rep = {-> range(10)->map({_, v -> submatch(v, true)})->string()}
+   let actual = substitute('A123456789', pat, Rep, '')
+   let expected = "[['A123456789'], ['1'], ['2'], ['3'], ['4'], ['5'], ['6'], 
['7'], ['8'], ['9']]"
+   assert_equal(expected, actual)
+ enddef
+ 
  def Test_synID()
    new
    setline(1, "text")
***************
*** 1655,1660 ****
--- 1664,1683 ----
    bwipe!
  enddef
  
+ def Test_term_gettty()
+   let buf = Run_shell_in_terminal({})
+   assert_notequal('', term_gettty(buf, true))
+   StopShellInTerminal(buf)
+ enddef
+ 
+ def Test_term_start()
+   botright new
+   let winnr = winnr()
+   term_start(&shell, #{curwin: true})
+   assert_equal(winnr, winnr())
+   bwipe!
+ enddef
+ 
  def Test_win_splitmove()
    split
    win_splitmove(1, 2, #{vertical: true, rightbelow: true})
*** ../vim-8.2.1626/src/version.c       2020-09-06 17:13:40.801413710 +0200
--- src/version.c       2020-09-06 17:57:01.226357437 +0200
***************
*** 756,757 ****
--- 756,759 ----
  {   /* Add new patch number below this line */
+ /**/
+     1627,
  /**/

-- 
It's not hard to meet expenses, they're everywhere.

 /// 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/202009061623.086GNQ6F942087%40masaka.moolenaar.net.

Raspunde prin e-mail lui