From 0c279bbb9c2b9fce1c837a35ace2d4644eced0b8 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Tue, 19 Mar 2013 14:25:54 +0100 Subject: 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) --- src/buffer.c | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) (limited to 'src/buffer.c') diff --git a/src/buffer.c b/src/buffer.c index 1f460b90fb..5c63899c83 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; -- cgit v1.2.3