To: vim_dev@googlegroups.com Subject: Patch 7.4.2023 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 7.4.2023 Problem: buflist_findname_stat() may find a dummy buffer. Solution: Set the BF_DUMMY flag after loading a dummy buffer. Start finding buffers from the end of the list. Files: src/quickfix.c, src/buffer.c *** ../vim-7.4.2022/src/quickfix.c 2016-07-10 18:21:45.728884145 +0200 --- src/quickfix.c 2016-07-10 20:16:09.850136314 +0200 *************** *** 4292,4297 **** --- 4292,4301 ---- aucmd_restbuf(&aco); if (newbuf_to_wipe != NULL && buf_valid(newbuf_to_wipe)) wipe_buffer(newbuf_to_wipe, FALSE); + + /* Add back the "dummy" flag, otherwise buflist_findname_stat() won't + * skip it. */ + newbuf->b_flags |= BF_DUMMY; } /* *** ../vim-7.4.2022/src/buffer.c 2016-07-10 19:03:47.703212491 +0200 --- src/buffer.c 2016-07-10 20:19:23.111229266 +0200 *************** *** 2270,2276 **** #endif buf_T *buf; ! for (buf = firstbuf; buf != NULL; buf = buf->b_next) if ((buf->b_flags & BF_DUMMY) == 0 && !otherfile_buf(buf, ffname #ifdef UNIX , stp --- 2270,2277 ---- #endif buf_T *buf; ! /* Start at the last buffer, expect to find a match sooner. */ ! for (buf = lastbuf; buf != NULL; buf = buf->b_prev) if ((buf->b_flags & BF_DUMMY) == 0 && !otherfile_buf(buf, ffname #ifdef UNIX , stp *************** *** 2355,2361 **** return -1; } ! for (buf = firstbuf; buf != NULL; buf = buf->b_next) if (buf->b_p_bl == find_listed #ifdef FEAT_DIFF && (!diffmode || diff_mode_buf(buf)) --- 2356,2362 ---- return -1; } ! for (buf = lastbuf; buf != NULL; buf = buf->b_prev) if (buf->b_p_bl == find_listed #ifdef FEAT_DIFF && (!diffmode || diff_mode_buf(buf)) *************** *** 2581,2587 **** if (nr == 0) nr = curwin->w_alt_fnum; ! for (buf = firstbuf; buf != NULL; buf = buf->b_next) if (buf->b_fnum == nr) return buf; return NULL; --- 2582,2589 ---- if (nr == 0) nr = curwin->w_alt_fnum; ! /* Assume newer buffers are used more often, start from the end. */ ! for (buf = lastbuf; buf != NULL; buf = buf->b_prev) if (buf->b_fnum == nr) return buf; return NULL; *** ../vim-7.4.2022/src/version.c 2016-07-10 19:22:49.194149187 +0200 --- src/version.c 2016-07-10 20:09:24.544234856 +0200 *************** *** 760,761 **** --- 760,763 ---- { /* Add new patch number below this line */ + /**/ + 2023, /**/ -- hundred-and-one symptoms of being an internet addict: 270. You are subscribed to a mailing list for every piece of software you use. /// Bram Moolenaar -- Bram@Moolenaar.net -- 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 ///