To: vim_dev@googlegroups.com Subject: Patch 8.1.0293 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.0293 Problem: Checks for type of stack is cryptic. Solution: Define IS_QF_STACK() and IS_LL_STACK(). (Yegappan Lakshmanan) Files: src/quickfix.c *** ../vim-8.1.0292/src/quickfix.c 2018-08-15 22:29:46.977604162 +0200 --- src/quickfix.c 2018-08-18 19:51:21.810177230 +0200 *************** *** 159,164 **** --- 159,169 ---- #define IS_QF_WINDOW(wp) (bt_quickfix(wp->w_buffer) && wp->w_llist_ref == NULL) /* Location list window check helper macro */ #define IS_LL_WINDOW(wp) (bt_quickfix(wp->w_buffer) && wp->w_llist_ref != NULL) + + // Quickfix and location list stack check helper macros + #define IS_QF_STACK(qi) (qi == &ql_info) + #define IS_LL_STACK(qi) (qi != &ql_info) + /* * Return location list for window 'wp' * For location list window, return the referenced location list *************** *** 1940,1946 **** qfp->qf_fnum = bufnum; if (buf != NULL) buf->b_has_qf_entry |= ! (qi == &ql_info) ? BUF_HAS_QF_ENTRY : BUF_HAS_LL_ENTRY; } else qfp->qf_fnum = qf_get_fnum(qi, qf_idx, dir, fname); --- 1945,1951 ---- qfp->qf_fnum = bufnum; if (buf != NULL) buf->b_has_qf_entry |= ! IS_QF_STACK(qi) ? BUF_HAS_QF_ENTRY : BUF_HAS_LL_ENTRY; } else qfp->qf_fnum = qf_get_fnum(qi, qf_idx, dir, fname); *************** *** 2224,2230 **** return 0; buf->b_has_qf_entry = ! (qi == &ql_info) ? BUF_HAS_QF_ENTRY : BUF_HAS_LL_ENTRY; return buf->b_fnum; } --- 2229,2235 ---- return 0; buf->b_has_qf_entry = ! IS_QF_STACK(qi) ? BUF_HAS_QF_ENTRY : BUF_HAS_LL_ENTRY; return buf->b_fnum; } *************** *** 2631,2637 **** if (cmdmod.split == 0 && curwin->w_width != Columns && curwin->w_width < 80) flags |= WSP_TOP; ! if (qi != &ql_info) flags |= WSP_NEWLOC; /* don't copy the location list */ if (win_split(0, flags) == FAIL) --- 2636,2642 ---- if (cmdmod.split == 0 && curwin->w_width != Columns && curwin->w_width < 80) flags |= WSP_TOP; ! if (IS_LL_STACK(qi)) flags |= WSP_NEWLOC; /* don't copy the location list */ if (win_split(0, flags) == FAIL) *************** *** 2642,2648 **** if (curwin->w_height < p_hh) win_setheight((int)p_hh); ! if (qi != &ql_info) /* not a quickfix list */ { /* The new window should use the supplied location list */ curwin->w_llist = qi; --- 2647,2653 ---- if (curwin->w_height < p_hh) win_setheight((int)p_hh); ! if (IS_LL_STACK(qi)) // not a quickfix list { /* The new window should use the supplied location list */ curwin->w_llist = qi; *************** *** 2918,2924 **** retval = buflist_getfile(qf_ptr->qf_fnum, (linenr_T)1, GETF_SETMARK | GETF_SWITCH, forceit); ! if (qi != &ql_info) { /* * Location list. Check whether the associated window is still --- 2923,2929 ---- retval = buflist_getfile(qf_ptr->qf_fnum, (linenr_T)1, GETF_SETMARK | GETF_SWITCH, forceit); ! if (IS_LL_STACK(qi)) { /* * Location list. Check whether the associated window is still *************** *** 2939,2945 **** else if (old_qf_curlist != qi->qf_curlist || !is_qf_entry_present(qi, qf_ptr)) { ! if (qi == &ql_info) EMSG(_("E925: Current quickfix was changed")); else EMSG(_(e_loc_list_changed)); --- 2944,2950 ---- else if (old_qf_curlist != qi->qf_curlist || !is_qf_entry_present(qi, qf_ptr)) { ! if (IS_QF_STACK(qi)) EMSG(_("E925: Current quickfix was changed")); else EMSG(_(e_loc_list_changed)); *************** *** 4040,4047 **** * pointing to the location list. */ if (bt_quickfix(win->w_buffer)) ! if ((qi == &ql_info && win->w_llist_ref == NULL) ! || (qi != &ql_info && win->w_llist_ref == qi)) return TRUE; return FALSE; --- 4045,4052 ---- * pointing to the location list. */ if (bt_quickfix(win->w_buffer)) ! if ((IS_QF_STACK(qi) && win->w_llist_ref == NULL) ! || (IS_LL_STACK(qi) && win->w_llist_ref == qi)) return TRUE; return FALSE; *************** *** 6955,6961 **** { apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name, curbuf->b_fname, TRUE, curbuf); ! if (!new_qi && qi != &ql_info && qf_find_buf(qi) == NULL) /* autocommands made "qi" invalid */ return; } --- 6960,6966 ---- { apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name, curbuf->b_fname, TRUE, curbuf); ! if (!new_qi && IS_LL_STACK(qi) && qf_find_buf(qi) == NULL) /* autocommands made "qi" invalid */ return; } *** ../vim-8.1.0292/src/version.c 2018-08-18 19:04:32.462231841 +0200 --- src/version.c 2018-08-18 19:58:34.263431696 +0200 *************** *** 796,797 **** --- 796,799 ---- { /* Add new patch number below this line */ + /**/ + 293, /**/ -- FATAL ERROR! SYSTEM HALTED! - Press any key to continue doing nothing. /// 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 ///