]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
updated for version 7.3.869 v7.3.869
authorBram Moolenaar <Bram@vim.org>
Tue, 19 Mar 2013 13:25:54 +0000 (14:25 +0100)
committerBram Moolenaar <Bram@vim.org>
Tue, 19 Mar 2013 13:25:54 +0000 (14:25 +0100)
Problem:    bufwinnr() matches buffers in other tabs.
Solution:   For bufwinnr() and ? only match buffers in the current tab.
            (Alexey Radkov)

src/buffer.c
src/diff.c
src/eval.c
src/ex_docmd.c
src/if_perl.xs
src/proto/buffer.pro
src/version.c

index 1f460b90fb14b1c398563148250975e793d81ee5..5c63899c83009b8937208f87fc83baa3b7603010 100644 (file)
@@ -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;
index 864e60914395b354cdbfac2bd3ba498f5c607650..f56046095cb9b7f0439959314d8f2885119a6875 100644 (file)
@@ -2152,7 +2152,7 @@ ex_diffgetput(eap)
            i = atol((char *)eap->arg);
        else
        {
-           i = buflist_findpat(eap->arg, p, FALSE, TRUE);
+           i = buflist_findpat(eap->arg, p, FALSE, TRUE, FALSE);
            if (i < 0)
                return;         /* error message already given */
        }
index 7df4f7ddab9ff82cbd39deb75d24654297c9df57..49120b8c047370367b6785b8e435281131075ba2 100644 (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)
index d258e69e7b6a6009b3191b07a3564cfc6ec77463..30fe937b560903c516e66b0172d9ded3196174d8 100644 (file)
@@ -2645,7 +2645,8 @@ do_one_cmd(cmdlinep, sourcing,
            while (p > ea.arg && vim_iswhite(p[-1]))
                --p;
        }
-       ea.line2 = buflist_findpat(ea.arg, p, (ea.argt & BUFUNL) != 0, FALSE);
+       ea.line2 = buflist_findpat(ea.arg, p, (ea.argt & BUFUNL) != 0,
+                                                               FALSE, FALSE);
        if (ea.line2 < 0)           /* failed */
            goto doend;
        ea.addr_count = 1;
index 67ffe18d94fab75f724632b4faec9d65d0757b5a..f9343293036eb0aa0cc7a5ce850acd986cba6a1e 100644 (file)
@@ -1056,7 +1056,7 @@ Buffers(...)
 
                pat = (char_u *)SvPV(sv, len);
                ++emsg_off;
-               b = buflist_findpat(pat, pat+len, FALSE, FALSE);
+               b = buflist_findpat(pat, pat+len, FALSE, FALSE, FALSE);
                --emsg_off;
            }
 
index 85aeddaef55aee7468117065a335f8b901c7d9ee..ad205c0b3c2bfd629dbfe52c404d1cacf69de7fd 100644 (file)
@@ -17,7 +17,7 @@ int buflist_getfile __ARGS((int n, linenr_T lnum, int options, int forceit));
 void buflist_getfpos __ARGS((void));
 buf_T *buflist_findname_exp __ARGS((char_u *fname));
 buf_T *buflist_findname __ARGS((char_u *ffname));
-int buflist_findpat __ARGS((char_u *pattern, char_u *pattern_end, int unlisted, int diffmode));
+int buflist_findpat __ARGS((char_u *pattern, char_u *pattern_end, int unlisted, int diffmode, int curtab_only));
 int ExpandBufnames __ARGS((char_u *pat, int *num_file, char_u ***file, int options));
 buf_T *buflist_findnr __ARGS((int nr));
 char_u *buflist_nr2name __ARGS((int n, int fullname, int helptail));
index 165b8e26da21539b2b7596412aebc59c400736c8..9eb46cae654246267fc98affc28c0e7d5892d542 100644 (file)
@@ -728,6 +728,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    869,
 /**/
     868,
 /**/