vim-patch:8.2.4462: not enough testing for quickfix code

Problem:    Not enough testing for quickfix code.
Solution:   Add more tests. Fix uncovered problem. (Yegappan Lakshmanan,
            closes vim/vim#9839)
9c9be05b17

Omit Test_helpgrep_vim9_restore_cpo().
Cherry-pick test_quickfix.vim change from patch 8.2.0644.
This commit is contained in:
zeertzjq
2022-10-13 10:13:17 +08:00
parent 73bdfdd382
commit cd1e0bb87d
4 changed files with 185 additions and 13 deletions

View File

@@ -1790,7 +1790,7 @@ void check_quickfix_busy(void)
/// @param type type character
/// @param valid valid entry
///
/// @returns QF_OK or QF_FAIL.
/// @return QF_OK on success or QF_FAIL on failure.
static int qf_add_entry(qf_list_T *qfl, char *dir, char *fname, char *module, int bufnum,
char *mesg, linenr_T lnum, linenr_T end_lnum, int col, int end_col,
char vis_col, char *pattern, int nr, char type, char valid)
@@ -3461,12 +3461,10 @@ void qf_view_result(bool split)
{
qf_info_T *qi = &ql_info;
if (!bt_quickfix(curbuf)) {
return;
}
if (IS_LL_WINDOW(curwin)) {
qi = GET_LOC_LIST(curwin);
}
if (qf_list_empty(qf_get_curlist(qi))) {
emsg(_(e_no_errors));
return;
@@ -3869,7 +3867,12 @@ static void qf_update_buffer(qf_info_T *qi, qfline_T *old_last)
if (curwin->w_llist == qi) {
win = curwin;
} else {
// Find the file window (non-quickfix) with this location list
win = qf_find_win_with_loclist(qi);
if (win == NULL) {
// File window is not found. Find the location list window.
win = qf_find_win(qi);
}
if (win == NULL) {
return;
}
@@ -7142,7 +7145,9 @@ void ex_helpgrep(exarg_T *eap)
if (new_qi) {
ll_free_all(&qi);
}
} else if (curwin->w_llist == NULL) {
} else if (curwin->w_llist == NULL && new_qi) {
// current window didn't have a location list associated with it
// before. Associate the new location list now.
curwin->w_llist = qi;
}
}