0
0
mirror of https://github.com/vim/vim.git synced 2025-09-26 04:04:07 -04:00

updated for version 7.3.869

Problem:    bufwinnr() matches buffers in other tabs.
Solution:   For bufwinnr() and ? only match buffers in the current tab.
            (Alexey Radkov)
This commit is contained in:
Bram Moolenaar
2013-03-19 14:25:54 +01:00
parent b59494cab1
commit 0c279bbb9c
7 changed files with 40 additions and 16 deletions

View File

@@ -9019,14 +9019,15 @@ f_bufloaded(argvars, rettv)
rettv->vval.v_number = (buf != NULL && buf->b_ml.ml_mfp != NULL);
}
static buf_T *get_buf_tv __ARGS((typval_T *tv));
static buf_T *get_buf_tv __ARGS((typval_T *tv, int curtab_only));
/*
* Get buffer by number or pattern.
*/
static buf_T *
get_buf_tv(tv)
get_buf_tv(tv, curtab_only)
typval_T *tv;
int curtab_only;
{
char_u *name = tv->vval.v_string;
int save_magic;
@@ -9049,7 +9050,7 @@ get_buf_tv(tv)
p_cpo = (char_u *)"";
buf = buflist_findnr(buflist_findpat(name, name + STRLEN(name),
TRUE, FALSE));
TRUE, FALSE, curtab_only));
p_magic = save_magic;
p_cpo = save_cpo;
@@ -9073,7 +9074,7 @@ f_bufname(argvars, rettv)
(void)get_tv_number(&argvars[0]); /* issue errmsg if type error */
++emsg_off;
buf = get_buf_tv(&argvars[0]);
buf = get_buf_tv(&argvars[0], FALSE);
rettv->v_type = VAR_STRING;
if (buf != NULL && buf->b_fname != NULL)
rettv->vval.v_string = vim_strsave(buf->b_fname);
@@ -9096,7 +9097,7 @@ f_bufnr(argvars, rettv)
(void)get_tv_number(&argvars[0]); /* issue errmsg if type error */
++emsg_off;
buf = get_buf_tv(&argvars[0]);
buf = get_buf_tv(&argvars[0], FALSE);
--emsg_off;
/* If the buffer isn't found and the second argument is not zero create a
@@ -9131,7 +9132,7 @@ f_bufwinnr(argvars, rettv)
(void)get_tv_number(&argvars[0]); /* issue errmsg if type error */
++emsg_off;
buf = get_buf_tv(&argvars[0]);
buf = get_buf_tv(&argvars[0], TRUE);
#ifdef FEAT_WINDOWS
for (wp = firstwin; wp; wp = wp->w_next)
{
@@ -11095,7 +11096,7 @@ f_getbufline(argvars, rettv)
(void)get_tv_number(&argvars[0]); /* issue errmsg if type error */
++emsg_off;
buf = get_buf_tv(&argvars[0]);
buf = get_buf_tv(&argvars[0], FALSE);
--emsg_off;
lnum = get_tv_lnum_buf(&argvars[1], buf);
@@ -11123,7 +11124,7 @@ f_getbufvar(argvars, rettv)
(void)get_tv_number(&argvars[0]); /* issue errmsg if type error */
varname = get_tv_string_chk(&argvars[1]);
++emsg_off;
buf = get_buf_tv(&argvars[0]);
buf = get_buf_tv(&argvars[0], FALSE);
if (argvars[2].v_type != VAR_UNKNOWN)
/* set the default value */
@@ -16216,7 +16217,7 @@ f_setbufvar(argvars, rettv)
return;
(void)get_tv_number(&argvars[0]); /* issue errmsg if type error */
varname = get_tv_string_chk(&argvars[1]);
buf = get_buf_tv(&argvars[0]);
buf = get_buf_tv(&argvars[0], FALSE);
varp = &argvars[2];
if (buf != NULL && varname != NULL && varp != NULL)