summaryrefslogtreecommitdiff
path: root/src/buffer.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2013-03-19 14:25:54 +0100
committerBram Moolenaar <Bram@vim.org>2013-03-19 14:25:54 +0100
commit0c279bbb9c2b9fce1c837a35ace2d4644eced0b8 (patch)
treeddfa055ce2fb8b8c92623c665e660a65b90c46a4 /src/buffer.c
parentb59494cab15310c8e2aaf59d48b270282c3e2017 (diff)
downloadvim-git-0c279bbb9c2b9fce1c837a35ace2d4644eced0b8.tar.gz
updated for version 7.3.869v7.3.869
Problem: bufwinnr() matches buffers in other tabs. Solution: For bufwinnr() and ? only match buffers in the current tab. (Alexey Radkov)
Diffstat (limited to 'src/buffer.c')
-rw-r--r--src/buffer.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/src/buffer.c b/src/buffer.c
index 1f460b90f..5c63899c8 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -928,7 +928,8 @@ do_bufdel(command, arg, addr_count, start_bnr, end_bnr, forceit)
if (!VIM_ISDIGIT(*arg))
{
p = skiptowhite_esc(arg);
- bnr = buflist_findpat(arg, p, command == DOBUF_WIPE, FALSE);
+ bnr = buflist_findpat(arg, p, command == DOBUF_WIPE,
+ FALSE, FALSE);
if (bnr < 0) /* failed */
break;
arg = p;
@@ -2129,18 +2130,20 @@ buflist_findname_stat(ffname, stp)
return NULL;
}
-#if defined(FEAT_LISTCMDS) || defined(FEAT_EVAL) || defined(FEAT_PERL) || defined(PROTO)
+#if defined(FEAT_LISTCMDS) || defined(FEAT_EVAL) || defined(FEAT_PERL) \
+ || defined(PROTO)
/*
* Find file in buffer list by a regexp pattern.
* Return fnum of the found buffer.
* Return < 0 for error.
*/
int
-buflist_findpat(pattern, pattern_end, unlisted, diffmode)
+buflist_findpat(pattern, pattern_end, unlisted, diffmode, curtab_only)
char_u *pattern;
char_u *pattern_end; /* pointer to first char after pattern */
int unlisted; /* find unlisted buffers */
int diffmode UNUSED; /* find diff-mode buffers only */
+ int curtab_only; /* find buffers in current tab only */
{
buf_T *buf;
regprog_T *prog;
@@ -2208,6 +2211,23 @@ buflist_findpat(pattern, pattern_end, unlisted, diffmode)
#endif
&& buflist_match(prog, buf) != NULL)
{
+ if (curtab_only)
+ {
+ /* Ignore the match if the buffer is not open in
+ * the current tab. */
+#ifdef FEAT_WINDOWS
+ win_T *wp;
+
+ for (wp = firstwin; wp != NULL; wp = wp->w_next)
+ if (wp->w_buffer == buf)
+ break;
+ if (wp == NULL)
+ continue;
+#else
+ if (curwin->w_buffer != buf)
+ continue;
+#endif
+ }
if (match >= 0) /* already found a match */
{
match = -2;