Patch 8.0.1386
Problem: Cannot select modified buffers with getbufinfo().
Solution: Add the "bufmodified" flag. (Yegappan Lakshmanan, closes #2431)
Files: runtime/doc/eval.txt, src/evalfunc.c,
src/testdir/test_bufwintabinfo.vim
*** ../vim-8.0.1385/runtime/doc/eval.txt 2017-12-10 15:25:12.506523247
+0100
--- runtime/doc/eval.txt 2017-12-10 21:02:56.340975234 +0100
***************
*** 4163,4168 ****
--- 4173,4179 ----
be specified in {dict}:
buflisted include only listed buffers.
bufloaded include only loaded buffers.
+ bufmodified include only modified buffers.
Otherwise, {expr} specifies a particular buffer to return
information for. For the use of {expr}, see |bufname()|
*** ../vim-8.0.1385/src/evalfunc.c 2017-12-02 15:43:28.494450656 +0100
--- src/evalfunc.c 2017-12-10 21:04:53.888319816 +0100
***************
*** 4137,4142 ****
--- 4137,4143 ----
int filtered = FALSE;
int sel_buflisted = FALSE;
int sel_bufloaded = FALSE;
+ int sel_bufmodified = FALSE;
if (rettv_list_alloc(rettv) != OK)
return;
***************
*** 4159,4164 ****
--- 4160,4169 ----
di = dict_find(sel_d, (char_u *)"bufloaded", -1);
if (di != NULL && get_tv_number(&di->di_tv))
sel_bufloaded = TRUE;
+
+ di = dict_find(sel_d, (char_u *)"bufmodified", -1);
+ if (di != NULL && get_tv_number(&di->di_tv))
+ sel_bufmodified = TRUE;
}
}
else if (argvars[0].v_type != VAR_UNKNOWN)
***************
*** 4178,4184 ****
if (argbuf != NULL && argbuf != buf)
continue;
if (filtered && ((sel_bufloaded && buf->b_ml.ml_mfp == NULL)
! || (sel_buflisted && !buf->b_p_bl)))
continue;
d = get_buffer_info(buf);
--- 4183,4190 ----
if (argbuf != NULL && argbuf != buf)
continue;
if (filtered && ((sel_bufloaded && buf->b_ml.ml_mfp == NULL)
! || (sel_buflisted && !buf->b_p_bl)
! || (sel_bufmodified && !buf->b_changed)))
continue;
d = get_buffer_info(buf);
*** ../vim-8.0.1385/src/testdir/test_bufwintabinfo.vim 2017-10-27
00:54:59.142125127 +0200
--- src/testdir/test_bufwintabinfo.vim 2017-12-10 21:02:56.344975212 +0100
***************
*** 20,25 ****
--- 20,32 ----
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})))
+ call setbufline('Xtestfile1', 1, ["Line1"])
+ let l = getbufinfo({'bufmodified' : 1})
+ call assert_equal(1, len(l))
+ call assert_equal(bufnr('Xtestfile1'), l[0].bufnr)
+
if has('signs')
call append(0, ['Linux', 'Windows', 'Mac'])
sign define Mark text=>> texthl=Search
*** ../vim-8.0.1385/src/version.c 2017-12-10 18:17:21.369310972 +0100
--- src/version.c 2017-12-10 21:04:14.144541508 +0100
***************
*** 773,774 ****
--- 773,776 ----
{ /* Add new patch number below this line */
+ /**/
+ 1386,
/**/
--
There's no place like $(HOME)!
/// 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].
For more options, visit https://groups.google.com/d/optout.