comparison src/quickfix.c @ 11301:cc8ece2aa389 v8.0.0536

patch 8.0.0536: quickfix window not updated when freeing quickfix stack commit https://github.com/vim/vim/commit/69f40be64555d50f603c6f22722cf762aaa6bbc1 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Apr 2 15:15:49 2017 +0200 patch 8.0.0536: quickfix window not updated when freeing quickfix stack Problem: Quickfix window not updated when freeing quickfix stack. Solution: Update the quickfix window. (Yegappan Lakshmanan)
author Christian Brabandt <cb@256bit.org>
date Sun, 02 Apr 2017 15:30:04 +0200
parents ae5f9f26f81c
children 83303ad9f1ff
comparison
equal deleted inserted replaced
11300:70dad27a2380 11301:cc8ece2aa389
4864 } 4864 }
4865 4865
4866 return retval; 4866 return retval;
4867 } 4867 }
4868 4868
4869 /*
4870 * Find the non-location list window with the specified location list.
4871 */
4872 static win_T *
4873 find_win_with_ll(qf_info_T *qi)
4874 {
4875 win_T *wp = NULL;
4876
4877 FOR_ALL_WINDOWS(wp)
4878 if ((wp->w_llist == qi) && !bt_quickfix(wp->w_buffer))
4879 return wp;
4880
4881 return NULL;
4882 }
4883
4884 /*
4885 * Free the entire quickfix/location list stack.
4886 * If the quickfix/location list window is open, then clear it.
4887 */
4869 static void 4888 static void
4870 qf_free_stack(win_T *wp, qf_info_T *qi) 4889 qf_free_stack(win_T *wp, qf_info_T *qi)
4871 { 4890 {
4891 win_T *qfwin = qf_find_win(qi);
4892 win_T *llwin = NULL;
4893 win_T *orig_wp = wp;
4894
4895 if (qfwin != NULL)
4896 {
4897 /* If the quickfix/location list window is open, then clear it */
4898 if (qi->qf_curlist < qi->qf_listcount)
4899 qf_free(qi, qi->qf_curlist);
4900 qf_update_buffer(qi, NULL);
4901 }
4902
4903 if (wp != NULL && IS_LL_WINDOW(wp))
4904 {
4905 /* If in the location list window, then use the non-location list
4906 * window with this location list (if present)
4907 */
4908 llwin = find_win_with_ll(qi);
4909 if (llwin != NULL)
4910 wp = llwin;
4911 }
4912
4872 qf_free_all(wp); 4913 qf_free_all(wp);
4873 if (wp == NULL) 4914 if (wp == NULL)
4874 { 4915 {
4875 /* quickfix list */ 4916 /* quickfix list */
4876 qi->qf_curlist = 0; 4917 qi->qf_curlist = 0;
4877 qi->qf_listcount = 0; 4918 qi->qf_listcount = 0;
4919 }
4920 else if (IS_LL_WINDOW(orig_wp))
4921 {
4922 /* If the location list window is open, then create a new empty
4923 * location list */
4924 qf_info_T *new_ll = ll_new_list();
4925 orig_wp->w_llist_ref = new_ll;
4926 if (llwin != NULL)
4927 {
4928 llwin->w_llist = new_ll;
4929 new_ll->qf_refcount++;
4930 }
4878 } 4931 }
4879 } 4932 }
4880 4933
4881 /* 4934 /*
4882 * Populate the quickfix list with the items supplied in the list 4935 * Populate the quickfix list with the items supplied in the list