To: vim_dev@googlegroups.com Subject: Patch 8.2.0019 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.0019 Problem: Cannot get number of lines of another buffer. Solution: Add "linecount" to getbufinfo(). (Yasuhiro Matsumoto, closes #5370) Files: src/evalbuffer.c, src/testdir/test_bufwintabinfo.vim, runtime/doc/eval.txt *** ../vim-8.2.0018/src/evalbuffer.c 2019-12-01 21:07:58.000000000 +0100 --- src/evalbuffer.c 2019-12-17 22:32:47.468392079 +0100 *************** *** 545,550 **** --- 545,551 ---- dict_add_string(dict, "name", buf->b_ffname); dict_add_number(dict, "lnum", buf == curbuf ? curwin->w_cursor.lnum : buflist_findlnum(buf)); + dict_add_number(dict, "linecount", buf->b_ml.ml_line_count); dict_add_number(dict, "loaded", buf->b_ml.ml_mfp != NULL); dict_add_number(dict, "listed", buf->b_p_bl); dict_add_number(dict, "changed", bufIsChanged(buf)); *** ../vim-8.2.0018/src/testdir/test_bufwintabinfo.vim 2019-12-01 15:02:54.000000000 +0100 --- src/testdir/test_bufwintabinfo.vim 2019-12-17 22:36:52.739595836 +0100 *************** *** 154,156 **** --- 154,166 ---- call assert_equal(getbufinfo('Xtestfile2')[0].lastused, 7654321) call test_settime(0) endfunc + + func Test_getbufinfo_lines() + new Xfoo + call setline(1, ['a', 'bc', 'd']) + let bn = bufnr('%') + hide + call assert_equal(3, getbufinfo(bn)[0]["linecount"]) + edit Xfoo + bw! + endfunc *** ../vim-8.2.0018/runtime/doc/eval.txt 2019-12-17 21:27:14.686319918 +0100 --- runtime/doc/eval.txt 2019-12-17 22:35:23.091889919 +0100 *************** *** 4796,4801 **** --- 4796,4803 ---- {only with the |+viminfo| feature} listed TRUE if the buffer is listed. lnum current line number in buffer. + linecount number of lines in the buffer (only + valid when loaded) loaded TRUE if the buffer is loaded. name full path to the file in the buffer. signs list of signs placed in the buffer. *** ../vim-8.2.0018/src/version.c 2019-12-17 22:10:54.564370706 +0100 --- src/version.c 2019-12-17 22:34:32.704053804 +0100 *************** *** 744,745 **** --- 744,747 ---- { /* Add new patch number below this line */ + /**/ + 19, /**/ -- DINGO: You must spank her well and after you have spanked her you may deal with her as you like and then ... spank me. AMAZING: And spank me! STUNNER: And me. LOVELY: And me. "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// Bram Moolenaar -- Bram@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 ///