Patch 8.1.1909
Problem:    More functions can be used as methods.
Solution:   Make a few more functions usable as a method.
Files:      runtime/doc/eval.txt, runtime/doc/testing.txt, src/evalfunc.c,
            src/testdir/test_popupwin.vim, src/testdir/test_bufwintabinfo.vim,
            src/testdir/test_bufline.vim, src/testdir/test_assert.vim


*** ../vim-8.1.1908/runtime/doc/eval.txt        2019-08-18 23:01:33.721885979 
+0200
--- runtime/doc/eval.txt        2019-08-21 22:39:55.710164887 +0200
***************
*** 1119,1125 ****
        expr8->(expr1, ...)[expr1]
  Evaluation is always from left to right.
  
- 
  expr8[expr1]          item of String or |List|        *expr-[]* *E111*
                                                        *E909* *subscript*
  If expr8 is a Number or String this results in a String that contains the
--- 1119,1124 ----
***************
*** 2589,2597 ****
  popup_dialog({what}, {options}) Number        create a popup window used as a 
dialog
  popup_filter_menu({id}, {key})  Number        filter for a menu popup window
  popup_filter_yesno({id}, {key}) Number        filter for a dialog popup window
  popup_getoptions({id})                Dict    get options of popup window {id}
  popup_getpos({id})            Dict    get position of popup window {id}
- popup_getpreview()            Number  get window ID of preview popup window
  popup_hide({id})              none    hide popup menu {id}
  popup_menu({what}, {options}) Number  create a popup window used as a menu
  popup_move({id}, {options})   none    set position of popup window {id}
--- 2593,2602 ----
  popup_dialog({what}, {options}) Number        create a popup window used as a 
dialog
  popup_filter_menu({id}, {key})  Number        filter for a menu popup window
  popup_filter_yesno({id}, {key}) Number        filter for a dialog popup window
+ popup_findinfo()              Number  get window ID of info popup window
+ popup_findpreview()           Number  get window ID of preview popup window
  popup_getoptions({id})                Dict    get options of popup window {id}
  popup_getpos({id})            Dict    get position of popup window {id}
  popup_hide({id})              none    hide popup menu {id}
  popup_menu({what}, {options}) Number  create a popup window used as a menu
  popup_move({id}, {options})   none    set position of popup window {id}
***************
*** 3270,3286 ****
  <
                Only deals with the current tab page.
  
  bufwinnr({expr})                                      *bufwinnr()*
!               The result is a Number, which is the number of the first
!               window associated with buffer {expr}.  For the use of {expr},
!               see |bufname()| above.  If buffer {expr} doesn't exist or
!               there is no such window, -1 is returned.  Example: >
  
        echo "A window containing buffer 1 is " . (bufwinnr(1))
  
  <             The number can be used with |CTRL-W_w| and ":wincmd w"
                |:wincmd|.
!               Only deals with the current tab page.
  
  byte2line({byte})                                     *byte2line()*
                Return the line number that contains the character at byte
--- 3275,3296 ----
  <
                Only deals with the current tab page.
  
+               Can also be used as a |method|: >
+                       FindBuffer()->bufwinid()
+ 
  bufwinnr({expr})                                      *bufwinnr()*
!               Like |bufwinid()| but return the window number instead of the
!               |window-ID|.
!               If buffer {expr} doesn't exist or there is no such window, -1
!               is returned.  Example: >
  
        echo "A window containing buffer 1 is " . (bufwinnr(1))
  
  <             The number can be used with |CTRL-W_w| and ":wincmd w"
                |:wincmd|.
! 
!               Can also be used as a |method|: >
!                       FindBuffer()->bufwinnr()
  
  byte2line({byte})                                     *byte2line()*
                Return the line number that contains the character at byte
***************
*** 9498,9503 ****
--- 9518,9526 ----
                Example: >
    :echo "The file in the current window is " . bufname(winbufnr(0))
  <
+               Can also be used as a |method|: >
+                       FindWindow()->winbufnr()->bufname()
+ <
                                                        *wincol()*
  wincol()      The result is a Number, which is the virtual column of the
                cursor in the window.  This is counting screen cells from the
***************
*** 9809,9815 ****
  hpux                  HP-UX version of Vim.
  iconv                 Can use iconv() for conversion.
  insert_expand         Compiled with support for CTRL-X expansion commands in
!                       Insert mode.
  jumplist              Compiled with |jumplist| support.
  keymap                        Compiled with 'keymap' support.
  lambda                        Compiled with |lambda| support.
--- 9832,9838 ----
  hpux                  HP-UX version of Vim.
  iconv                 Can use iconv() for conversion.
  insert_expand         Compiled with support for CTRL-X expansion commands in
!                       Insert mode. (always true)
  jumplist              Compiled with |jumplist| support.
  keymap                        Compiled with 'keymap' support.
  lambda                        Compiled with |lambda| support.
*** ../vim-8.1.1908/runtime/doc/testing.txt     2019-08-16 21:49:17.582152291 
+0200
--- runtime/doc/testing.txt     2019-08-21 22:46:58.992300208 +0200
***************
*** 238,243 ****
--- 238,247 ----
                mention that.
                Mainly useful with |terminal-diff|.
  
+               Can also be used as a |method|: >
+                       GetLog()->assert_equalfile('expected.log')
+ 
+ 
  assert_exception({error} [, {msg}])                   *assert_exception()*
                When v:exception does not contain the string {error} an error
                message is added to |v:errors|.  Also see |assert-return|.
***************
*** 322,331 ****
--- 326,340 ----
                Can also be used as a |method|: >
                        getFile()->assert_notmatch('bar.*')
  
+ 
  assert_report({msg})                                  *assert_report()*
                Report a test failure directly, using {msg}.
                Always returns one.
  
+               Can also be used as a |method|: >
+                       GetMessage()->assert_report()
+ 
+ 
  assert_true({actual} [, {msg}])                               *assert_true()*
                When {actual} is not true an error message is added to
                |v:errors|, like with |assert_equal()|.
*** ../vim-8.1.1908/src/evalfunc.c      2019-08-21 18:30:58.882719474 +0200
--- src/evalfunc.c      2019-08-21 22:47:10.492249578 +0200
***************
*** 431,437 ****
  #endif
      {"assert_beeps",  1, 2, FEARG_1,    f_assert_beeps},
      {"assert_equal",  2, 3, FEARG_2,    f_assert_equal},
!     {"assert_equalfile", 2, 2, 0,       f_assert_equalfile},
      {"assert_exception", 1, 2, 0,       f_assert_exception},
      {"assert_fails",  1, 3, FEARG_1,    f_assert_fails},
      {"assert_false",  1, 2, FEARG_1,    f_assert_false},
--- 431,437 ----
  #endif
      {"assert_beeps",  1, 2, FEARG_1,    f_assert_beeps},
      {"assert_equal",  2, 3, FEARG_2,    f_assert_equal},
!     {"assert_equalfile", 2, 2, FEARG_1,         f_assert_equalfile},
      {"assert_exception", 1, 2, 0,       f_assert_exception},
      {"assert_fails",  1, 3, FEARG_1,    f_assert_fails},
      {"assert_false",  1, 2, FEARG_1,    f_assert_false},
***************
*** 439,445 ****
      {"assert_match",  2, 3, FEARG_2,    f_assert_match},
      {"assert_notequal",       2, 3, FEARG_2,    f_assert_notequal},
      {"assert_notmatch",       2, 3, FEARG_2,    f_assert_notmatch},
!     {"assert_report", 1, 1, 0,          f_assert_report},
      {"assert_true",   1, 2, FEARG_1,    f_assert_true},
  #ifdef FEAT_FLOAT
      {"atan",          1, 1, FEARG_1,    f_atan},
--- 439,445 ----
      {"assert_match",  2, 3, FEARG_2,    f_assert_match},
      {"assert_notequal",       2, 3, FEARG_2,    f_assert_notequal},
      {"assert_notmatch",       2, 3, FEARG_2,    f_assert_notmatch},
!     {"assert_report", 1, 1, FEARG_1,    f_assert_report},
      {"assert_true",   1, 2, FEARG_1,    f_assert_true},
  #ifdef FEAT_FLOAT
      {"atan",          1, 1, FEARG_1,    f_atan},
***************
*** 464,471 ****
      {"bufloaded",     1, 1, FEARG_1,    f_bufloaded},
      {"bufname",               1, 1, FEARG_1,    f_bufname},
      {"bufnr",         1, 2, FEARG_1,    f_bufnr},
!     {"bufwinid",      1, 1, 0,          f_bufwinid},
!     {"bufwinnr",      1, 1, 0,          f_bufwinnr},
      {"byte2line",     1, 1, 0,          f_byte2line},
      {"byteidx",               2, 2, 0,          f_byteidx},
      {"byteidxcomp",   2, 2, 0,          f_byteidxcomp},
--- 464,471 ----
      {"bufloaded",     1, 1, FEARG_1,    f_bufloaded},
      {"bufname",               1, 1, FEARG_1,    f_bufname},
      {"bufnr",         1, 2, FEARG_1,    f_bufnr},
!     {"bufwinid",      1, 1, FEARG_1,    f_bufwinid},
!     {"bufwinnr",      1, 1, FEARG_1,    f_bufwinnr},
      {"byte2line",     1, 1, 0,          f_byte2line},
      {"byteidx",               2, 2, 0,          f_byteidx},
      {"byteidxcomp",   2, 2, 0,          f_byteidxcomp},
***************
*** 963,969 ****
      {"win_id2tabwin", 1, 1, 0,          f_win_id2tabwin},
      {"win_id2win",    1, 1, 0,          f_win_id2win},
      {"win_screenpos", 1, 1, 0,          f_win_screenpos},
!     {"winbufnr",      1, 1, 0,          f_winbufnr},
      {"wincol",                0, 0, 0,          f_wincol},
      {"winheight",     1, 1, 0,          f_winheight},
      {"winlayout",     0, 1, 0,          f_winlayout},
--- 963,969 ----
      {"win_id2tabwin", 1, 1, 0,          f_win_id2tabwin},
      {"win_id2win",    1, 1, 0,          f_win_id2win},
      {"win_screenpos", 1, 1, 0,          f_win_screenpos},
!     {"winbufnr",      1, 1, FEARG_1,    f_winbufnr},
      {"wincol",                0, 0, 0,          f_wincol},
      {"winheight",     1, 1, 0,          f_winheight},
      {"winlayout",     0, 1, 0,          f_winlayout},
*** ../vim-8.1.1908/src/testdir/test_popupwin.vim       2019-08-21 
22:25:26.034016761 +0200
--- src/testdir/test_popupwin.vim       2019-08-21 22:32:26.552148563 +0200
***************
*** 2332,2339 ****
  endfunc
  
  func Test_popupwin_recycle_bnr()
!   let winid = popup_notification('nothing wrong', {})
!   let bufnr = winbufnr(winid)
    call popup_clear()
    let winid = popup_notification('nothing wrong', {})
    call assert_equal(bufnr, winbufnr(winid))
--- 2332,2338 ----
  endfunc
  
  func Test_popupwin_recycle_bnr()
!   let bufnr = popup_notification('nothing wrong', {})->winbufnr()
    call popup_clear()
    let winid = popup_notification('nothing wrong', {})
    call assert_equal(bufnr, winbufnr(winid))
*** ../vim-8.1.1908/src/testdir/test_bufwintabinfo.vim  2018-07-15 
17:01:06.357425513 +0200
--- src/testdir/test_bufwintabinfo.vim  2019-08-21 22:35:51.803241133 +0200
***************
*** 18,24 ****
      let l = getbufinfo('%')
      call assert_equal(bufnr('%'), l[0].bufnr)
      call assert_equal('vim', l[0].variables.editor)
!     call assert_notequal(-1, index(l[0].windows, bufwinid('%')))
  
      " Test for getbufinfo() with 'bufmodified'
      call assert_equal(0, len(getbufinfo({'bufmodified' : 1})))
--- 18,24 ----
      let l = getbufinfo('%')
      call assert_equal(bufnr('%'), l[0].bufnr)
      call assert_equal('vim', l[0].variables.editor)
!     call assert_notequal(-1, index(l[0].windows, '%'->bufwinid()))
  
      " Test for getbufinfo() with 'bufmodified'
      call assert_equal(0, len(getbufinfo({'bufmodified' : 1})))
*** ../vim-8.1.1908/src/testdir/test_bufline.vim        2019-08-07 
23:07:03.960858821 +0200
--- src/testdir/test_bufline.vim        2019-08-21 22:37:07.858905335 +0200
***************
*** 152,162 ****
  
    let lines =<< trim END
      new foo
!     let winnr=bufwinnr('foo')
!     let buf=bufnr('foo')
      wincmd p
      call appendbufline(buf, '$', range(1,200))
!     exe winnr. 'wincmd w'
      norm! G
      wincmd p
      call deletebufline(buf, 1, '$')
--- 152,162 ----
  
    let lines =<< trim END
      new foo
!     let winnr = 'foo'->bufwinnr()
!     let buf = bufnr('foo')
      wincmd p
      call appendbufline(buf, '$', range(1,200))
!     exe winnr .. 'wincmd w'
      norm! G
      wincmd p
      call deletebufline(buf, 1, '$')
*** ../vim-8.1.1908/src/testdir/test_assert.vim 2019-08-16 21:49:17.582152291 
+0200
--- src/testdir/test_assert.vim 2019-08-21 22:47:44.220101128 +0200
***************
*** 54,60 ****
  
    let goodtext = ["one", "two", "three"]
    call writefile(goodtext, 'Xone')
!   call assert_equal(1, assert_equalfile('Xone', 'xyzxyz'))
    call assert_match("E485: Can't read file xyzxyz", v:errors[0])
    call remove(v:errors, 0)
  
--- 54,60 ----
  
    let goodtext = ["one", "two", "three"]
    call writefile(goodtext, 'Xone')
!   call assert_equal(1, 'Xone'->assert_equalfile('xyzxyz'))
    call assert_match("E485: Can't read file xyzxyz", v:errors[0])
    call remove(v:errors, 0)
  
***************
*** 97,102 ****
--- 97,105 ----
    call assert_equal(1, assert_report('something is wrong'))
    call assert_match('something is wrong', v:errors[0])
    call remove(v:errors, 0)
+   call assert_equal(1, 'also wrong'->assert_report())
+   call assert_match('also wrong', v:errors[0])
+   call remove(v:errors, 0)
  endfunc
  
  func Test_assert_exception()
*** ../vim-8.1.1908/src/version.c       2019-08-21 22:25:26.034016761 +0200
--- src/version.c       2019-08-21 22:48:14.119969519 +0200
***************
*** 763,764 ****
--- 763,766 ----
  {   /* Add new patch number below this line */
+ /**/
+     1909,
  /**/

-- 
>From "know your smileys":
 :-| :-|   Deja' vu!

 /// 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/201908212050.x7LKoZKP025805%40masaka.moolenaar.net.

Raspunde prin e-mail lui