From c147806e23d0ade781b8a298924150fe8d5887ad Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Fri, 20 Dec 2019 00:02:36 -0500 Subject: vim-patch:8.2.0019: cannot number of lines of another buffer Problem: Cannot number of lines of another buffer. Solution: Add "linecount" to getbufinfo(). (Yasuhiro Matsumoto, closes vim/vim#5370) https://github.com/vim/vim/commit/a9e9679de3ef082ee29868ab404283dfc53258f2 --- runtime/doc/eval.txt | 2 ++ src/nvim/eval.c | 1 + src/nvim/testdir/test_bufwintabinfo.vim | 10 ++++++++++ 3 files changed, 13 insertions(+) diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index d02ed54e27..77589b732d 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -4138,6 +4138,8 @@ getbufinfo([{dict}]) hidden TRUE if the buffer is hidden. 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. diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 902d68dcf9..04899f2c99 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -9922,6 +9922,7 @@ static dict_T *get_buffer_info(buf_T *buf) buf->b_ffname != NULL ? (const char *)buf->b_ffname : ""); tv_dict_add_nr(dict, S_LEN("lnum"), buf == curbuf ? curwin->w_cursor.lnum : buflist_findlnum(buf)); + tv_dict_add_nr(dict, S_LEN("linecount"), buf->b_ml.ml_line_count); tv_dict_add_nr(dict, S_LEN("loaded"), buf->b_ml.ml_mfp != NULL); tv_dict_add_nr(dict, S_LEN("listed"), buf->b_p_bl); tv_dict_add_nr(dict, S_LEN("changed"), bufIsChanged(buf)); diff --git a/src/nvim/testdir/test_bufwintabinfo.vim b/src/nvim/testdir/test_bufwintabinfo.vim index 0e8c7d1dc1..176d49d28e 100644 --- a/src/nvim/testdir/test_bufwintabinfo.vim +++ b/src/nvim/testdir/test_bufwintabinfo.vim @@ -139,3 +139,13 @@ function Test_get_win_options() set foldlevel=0 endif 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 -- cgit From a115f2314387706242ce5b9e5b2d7090a902d9cb Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Fri, 20 Dec 2019 00:31:56 -0500 Subject: vim-patch:8.2.0024: filetype Rego not recognized Problem: Filetype Rego not recognized. Solution: Add *.rego. (Matt Dunford, closes vim/vim#5376) https://github.com/vim/vim/commit/a4ce82fe2e990eb9eaabf6ad400e2a74cce50ce6 --- runtime/filetype.vim | 3 +++ src/nvim/testdir/test_filetype.vim | 1 + 2 files changed, 4 insertions(+) diff --git a/runtime/filetype.vim b/runtime/filetype.vim index e27d234a96..e66630259e 100644 --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -1299,6 +1299,9 @@ au BufNewFile,BufRead *.reg " Renderman Interface Bytestream au BufNewFile,BufRead *.rib setf rib +" Rego Policy Language +au BufNewFile,BufRead *.rego setf rego + " Rexx au BufNewFile,BufRead *.rex,*.orx,*.rxo,*.rxj,*.jrexx,*.rexxj,*.rexx,*.testGroup,*.testUnit setf rexx diff --git a/src/nvim/testdir/test_filetype.vim b/src/nvim/testdir/test_filetype.vim index e085f58e56..cc0037b4cf 100644 --- a/src/nvim/testdir/test_filetype.vim +++ b/src/nvim/testdir/test_filetype.vim @@ -364,6 +364,7 @@ let s:filename_checks = { \ 'rcs': ['file,v'], \ 'readline': ['.inputrc', 'inputrc'], \ 'remind': ['.reminders', 'file.remind', 'file.rem'], + \ 'rego': ['file.rego'], \ 'resolv': ['resolv.conf'], \ 'reva': ['file.frt'], \ 'rexx': ['file.rex', 'file.orx', 'file.rxo', 'file.rxj', 'file.jrexx', 'file.rexxj', 'file.rexx', 'file.testGroup', 'file.testUnit'], -- cgit