summaryrefslogtreecommitdiff
path: root/src/quickfix.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-04-02 15:15:49 +0200
committerBram Moolenaar <Bram@vim.org>2017-04-02 15:15:49 +0200
commit69f40be64555d50f603c6f22722cf762aaa6bbc1 (patch)
tree7748163b2cc57004f546ea1091dbc7bd594ba2c9 /src/quickfix.c
parent6914c64ee58ce68f31fb8a8793293a9b3f2f6240 (diff)
downloadvim-git-69f40be64555d50f603c6f22722cf762aaa6bbc1.tar.gz
patch 8.0.0536: quickfix window not updated when freeing quickfix stackv8.0.0536
Problem: Quickfix window not updated when freeing quickfix stack. Solution: Update the quickfix window. (Yegappan Lakshmanan)
Diffstat (limited to 'src/quickfix.c')
-rw-r--r--src/quickfix.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/src/quickfix.c b/src/quickfix.c
index 466c5c2e8..58fcd1101 100644
--- a/src/quickfix.c
+++ b/src/quickfix.c
@@ -4866,9 +4866,50 @@ qf_set_properties(qf_info_T *qi, dict_T *what, int action)
return retval;
}
+/*
+ * Find the non-location list window with the specified location list.
+ */
+ static win_T *
+find_win_with_ll(qf_info_T *qi)
+{
+ win_T *wp = NULL;
+
+ FOR_ALL_WINDOWS(wp)
+ if ((wp->w_llist == qi) && !bt_quickfix(wp->w_buffer))
+ return wp;
+
+ return NULL;
+}
+
+/*
+ * Free the entire quickfix/location list stack.
+ * If the quickfix/location list window is open, then clear it.
+ */
static void
qf_free_stack(win_T *wp, qf_info_T *qi)
{
+ win_T *qfwin = qf_find_win(qi);
+ win_T *llwin = NULL;
+ win_T *orig_wp = wp;
+
+ if (qfwin != NULL)
+ {
+ /* If the quickfix/location list window is open, then clear it */
+ if (qi->qf_curlist < qi->qf_listcount)
+ qf_free(qi, qi->qf_curlist);
+ qf_update_buffer(qi, NULL);
+ }
+
+ if (wp != NULL && IS_LL_WINDOW(wp))
+ {
+ /* If in the location list window, then use the non-location list
+ * window with this location list (if present)
+ */
+ llwin = find_win_with_ll(qi);
+ if (llwin != NULL)
+ wp = llwin;
+ }
+
qf_free_all(wp);
if (wp == NULL)
{
@@ -4876,6 +4917,18 @@ qf_free_stack(win_T *wp, qf_info_T *qi)
qi->qf_curlist = 0;
qi->qf_listcount = 0;
}
+ else if (IS_LL_WINDOW(orig_wp))
+ {
+ /* If the location list window is open, then create a new empty
+ * location list */
+ qf_info_T *new_ll = ll_new_list();
+ orig_wp->w_llist_ref = new_ll;
+ if (llwin != NULL)
+ {
+ llwin->w_llist = new_ll;
+ new_ll->qf_refcount++;
+ }
+ }
}
/*