Patch 8.2.1888
Problem:    Vim9: Getbufline(-1, 1, '$') gives an error.
Solution:   Return an empty list. (closes #7180)
Files:      src/evalbuffer.c, src/testdir/test_vim9_builtin.vim


*** ../vim-8.2.1887/src/evalbuffer.c    2020-09-05 17:37:00.845133066 +0200
--- src/evalbuffer.c    2020-10-22 18:20:49.281849090 +0200
***************
*** 717,733 ****
      void
  f_getbufline(typval_T *argvars, typval_T *rettv)
  {
!     linenr_T  lnum;
!     linenr_T  end;
      buf_T     *buf;
  
      buf = tv_get_buf_from_arg(&argvars[0]);
! 
!     lnum = tv_get_lnum_buf(&argvars[1], buf);
!     if (argvars[2].v_type == VAR_UNKNOWN)
!       end = lnum;
!     else
!       end = tv_get_lnum_buf(&argvars[2], buf);
  
      get_buffer_lines(buf, lnum, end, TRUE, rettv);
  }
--- 717,735 ----
      void
  f_getbufline(typval_T *argvars, typval_T *rettv)
  {
!     linenr_T  lnum = 1;
!     linenr_T  end = 1;
      buf_T     *buf;
  
      buf = tv_get_buf_from_arg(&argvars[0]);
!     if (buf != NULL)
!     {
!       lnum = tv_get_lnum_buf(&argvars[1], buf);
!       if (argvars[2].v_type == VAR_UNKNOWN)
!           end = lnum;
!       else
!           end = tv_get_lnum_buf(&argvars[2], buf);
!     }
  
      get_buffer_lines(buf, lnum, end, TRUE, rettv);
  }
*** ../vim-8.2.1887/src/testdir/test_vim9_builtin.vim   2020-10-21 
16:42:18.517821898 +0200
--- src/testdir/test_vim9_builtin.vim   2020-10-22 18:22:56.713414815 +0200
***************
*** 242,247 ****
--- 242,249 ----
    var lines = ['aaa', 'bbb', 'ccc']
    setbufline(buf, 1, lines)
    getbufline('#', 1, '$')->assert_equal(lines)
+   getbufline(-1, '$', '$')->assert_equal([])
+   getbufline(-1, 1, '$')->assert_equal([])
  
    bwipe!
  enddef
*** ../vim-8.2.1887/src/version.c       2020-10-22 17:33:12.469081986 +0200
--- src/version.c       2020-10-22 18:22:24.325523536 +0200
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     1888,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
110. You actually volunteer to become your employer's webmaster.

 /// Bram Moolenaar -- b...@moolenaar.net -- 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 vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202010221624.09MGOH9N398372%40masaka.moolenaar.net.

Raspunde prin e-mail lui