comparison src/quickfix.c @ 9982:e24aa20d815c v7.4.2264

commit https://github.com/vim/vim/commit/2b529bb6260b52246e92429375d995b9b5ce76b6 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Aug 27 13:35:35 2016 +0200 patch 7.4.2264 Problem: When adding entries to an empty quickfix list the title is reset. Solution: Improve handling of the title. (Yegappan Lakshmanan)
author Christian Brabandt <cb@256bit.org>
date Sat, 27 Aug 2016 13:45:05 +0200
parents 05bfc3d37efb
children 4aead6a9b7a9
comparison
equal deleted inserted replaced
9981:9137289034e5 9982:e24aa20d815c
4751 4751
4752 return retval; 4752 return retval;
4753 } 4753 }
4754 4754
4755 static int 4755 static int
4756 qf_set_properties(qf_info_T *qi, dict_T *what) 4756 qf_set_properties(qf_info_T *qi, dict_T *what, int action)
4757 { 4757 {
4758 dictitem_T *di; 4758 dictitem_T *di;
4759 int retval = FAIL; 4759 int retval = FAIL;
4760 int qf_idx; 4760 int qf_idx;
4761 int newlist = FALSE;
4762
4763 if (action == ' ' || qi->qf_curlist == qi->qf_listcount)
4764 newlist = TRUE;
4761 4765
4762 qf_idx = qi->qf_curlist; /* default is the current list */ 4766 qf_idx = qi->qf_curlist; /* default is the current list */
4763 if ((di = dict_find(what, (char_u *)"nr", -1)) != NULL) 4767 if ((di = dict_find(what, (char_u *)"nr", -1)) != NULL)
4764 { 4768 {
4765 /* Use the specified quickfix/location list */ 4769 /* Use the specified quickfix/location list */
4769 if (qf_idx < 0 || qf_idx >= qi->qf_listcount) 4773 if (qf_idx < 0 || qf_idx >= qi->qf_listcount)
4770 return FAIL; 4774 return FAIL;
4771 } 4775 }
4772 else 4776 else
4773 return FAIL; 4777 return FAIL;
4778 newlist = FALSE; /* use the specified list */
4779 }
4780
4781 if (newlist)
4782 {
4783 qf_new_list(qi, NULL);
4784 qf_idx = qi->qf_curlist;
4774 } 4785 }
4775 4786
4776 if ((di = dict_find(what, (char_u *)"title", -1)) != NULL) 4787 if ((di = dict_find(what, (char_u *)"title", -1)) != NULL)
4777 { 4788 {
4778 if (di->di_tv.v_type == VAR_STRING) 4789 if (di->di_tv.v_type == VAR_STRING)
4811 if (qi == NULL) 4822 if (qi == NULL)
4812 return FAIL; 4823 return FAIL;
4813 } 4824 }
4814 4825
4815 if (what != NULL) 4826 if (what != NULL)
4816 retval = qf_set_properties(qi, what); 4827 retval = qf_set_properties(qi, what, action);
4817 else 4828 else
4818 retval = qf_add_entries(qi, list, title, action); 4829 retval = qf_add_entries(qi, list, title, action);
4819 4830
4820 return retval; 4831 return retval;
4821 } 4832 }