Merge #10049 'vim-patch:8.1.0293'

This commit is contained in:
Justin M. Keyes
2019-05-22 11:59:04 +02:00
2 changed files with 32 additions and 27 deletions

View File

@@ -4488,7 +4488,7 @@ void fname_expand(buf_T *buf, char_u **ffname, char_u **sfname)
if (*sfname == NULL) { // if no short file name given, use ffname if (*sfname == NULL) { // if no short file name given, use ffname
*sfname = *ffname; *sfname = *ffname;
} }
*ffname = (char_u *)fix_fname((char *)*ffname); // expand to full path *ffname = (char_u *)fix_fname((char *)(*ffname)); // expand to full path
#ifdef WIN32 #ifdef WIN32
if (!buf->b_p_bin) { if (!buf->b_p_bin) {

View File

@@ -198,10 +198,15 @@ typedef struct {
#define IS_QF_WINDOW(wp) (bt_quickfix(wp->w_buffer) && wp->w_llist_ref == NULL) #define IS_QF_WINDOW(wp) (bt_quickfix(wp->w_buffer) && wp->w_llist_ref == NULL)
/* Location list window check helper macro */ /* Location list window check helper macro */
#define IS_LL_WINDOW(wp) (bt_quickfix(wp->w_buffer) && wp->w_llist_ref != NULL) #define IS_LL_WINDOW(wp) (bt_quickfix(wp->w_buffer) && wp->w_llist_ref != NULL)
/*
* Return location list for window 'wp' // Quickfix and location list stack check helper macros
* For location list window, return the referenced location list #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
//
#define GET_LOC_LIST(wp) (IS_LL_WINDOW(wp) ? wp->w_llist_ref : wp->w_llist) #define GET_LOC_LIST(wp) (IS_LL_WINDOW(wp) ? wp->w_llist_ref : wp->w_llist)
// Looking up a buffer can be slow if there are many. Remember the last one // Looking up a buffer can be slow if there are many. Remember the last one
@@ -1430,7 +1435,7 @@ static int qf_add_entry(qf_info_T *qi, int qf_idx, char_u *dir, char_u *fname,
qfp->qf_fnum = bufnum; qfp->qf_fnum = bufnum;
if (buf != NULL) { if (buf != NULL) {
buf->b_has_qf_entry |= buf->b_has_qf_entry |=
(qi == &ql_info) ? BUF_HAS_QF_ENTRY : BUF_HAS_LL_ENTRY; IS_QF_STACK(qi) ? BUF_HAS_QF_ENTRY : BUF_HAS_LL_ENTRY;
} }
} else { } else {
qfp->qf_fnum = qf_get_fnum(qi, qf_idx, dir, fname); qfp->qf_fnum = qf_get_fnum(qi, qf_idx, dir, fname);
@@ -1679,7 +1684,7 @@ static int qf_get_fnum(qf_info_T *qi, int qf_idx, char_u *directory,
return 0; return 0;
} }
buf->b_has_qf_entry = buf->b_has_qf_entry =
(qi == &ql_info) ? BUF_HAS_QF_ENTRY : BUF_HAS_LL_ENTRY; IS_QF_STACK(qi) ? BUF_HAS_QF_ENTRY : BUF_HAS_LL_ENTRY;
return buf->b_fnum; return buf->b_fnum;
} }
@@ -2019,7 +2024,7 @@ static int jump_to_help_window(qf_info_T *qi, int *opened_window)
flags |= WSP_TOP; flags |= WSP_TOP;
} }
if (qi != &ql_info) { if (IS_LL_STACK(qi)) {
flags |= WSP_NEWLOC; // don't copy the location list flags |= WSP_NEWLOC; // don't copy the location list
} }
@@ -2033,7 +2038,7 @@ static int jump_to_help_window(qf_info_T *qi, int *opened_window)
win_setheight((int)p_hh); win_setheight((int)p_hh);
} }
if (qi != &ql_info) { // not a quickfix list if (IS_LL_STACK(qi)) { // not a quickfix list
// The new window should use the supplied location list // The new window should use the supplied location list
curwin->w_llist = qi; curwin->w_llist = qi;
qi->qf_refcount++; qi->qf_refcount++;
@@ -2216,7 +2221,7 @@ static int qf_jump_edit_buffer(qf_info_T *qi, qfline_T *qf_ptr, int forceit,
retval = buflist_getfile(qf_ptr->qf_fnum, (linenr_T)1, retval = buflist_getfile(qf_ptr->qf_fnum, (linenr_T)1,
GETF_SETMARK | GETF_SWITCH, forceit); GETF_SETMARK | GETF_SWITCH, forceit);
if (qi != &ql_info) { if (IS_LL_STACK(qi)) {
// Location list. Check whether the associated window is still // Location list. Check whether the associated window is still
// present and the list is still valid. // present and the list is still valid.
if (!win_valid_any_tab(oldwin)) { if (!win_valid_any_tab(oldwin)) {
@@ -2229,7 +2234,7 @@ static int qf_jump_edit_buffer(qf_info_T *qi, qfline_T *qf_ptr, int forceit,
} }
} else if (old_qf_curlist != qi->qf_curlist } else if (old_qf_curlist != qi->qf_curlist
|| !is_qf_entry_present(qi, qf_ptr)) { || !is_qf_entry_present(qi, qf_ptr)) {
if (qi == &ql_info) { if (IS_QF_STACK(qi)) {
EMSG(_("E925: Current quickfix was changed")); EMSG(_("E925: Current quickfix was changed"));
} else { } else {
EMSG(_(e_loc_list_changed)); EMSG(_(e_loc_list_changed));
@@ -3104,24 +3109,24 @@ qf_win_pos_update (
return win != NULL; return win != NULL;
} }
/* /// Checks whether the given window is displaying the specified
* Check whether the given window is displaying the specified quickfix/location /// quickfix/location list buffer.
* list buffer
*/
static int is_qf_win(win_T *win, qf_info_T *qi) static int is_qf_win(win_T *win, qf_info_T *qi)
{ {
/* //
* A window displaying the quickfix buffer will have the w_llist_ref field // A window displaying the quickfix buffer will have the w_llist_ref field
* set to NULL. // set to NULL.
* A window displaying a location list buffer will have the w_llist_ref // A window displaying a location list buffer will have the w_llist_ref
* pointing to the location list. // pointing to the location list.
*/ //
if (bt_quickfix(win->w_buffer)) if (bt_quickfix(win->w_buffer)) {
if ((qi == &ql_info && win->w_llist_ref == NULL) if ((IS_QF_STACK(qi) && win->w_llist_ref == NULL)
|| (qi != &ql_info && win->w_llist_ref == qi)) || (IS_LL_STACK(qi) && win->w_llist_ref == qi)) {
return TRUE; return true;
}
}
return FALSE; return false;
} }
/// Find a window displaying the quickfix/location list 'qi' /// Find a window displaying the quickfix/location list 'qi'
@@ -5498,7 +5503,7 @@ void ex_helpgrep(exarg_T *eap)
if (au_name != NULL) { if (au_name != NULL) {
apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name, apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name,
curbuf->b_fname, true, curbuf); curbuf->b_fname, true, curbuf);
if (!new_qi && qi != &ql_info && qf_find_buf(qi) == NULL) { if (!new_qi && IS_LL_STACK(qi) && qf_find_buf(qi) == NULL) {
// autocommands made "qi" invalid // autocommands made "qi" invalid
return; return;
} }