patch 8.0.0904: cannot set a location list from text
Problem: Cannot set a location list from text.
Solution: Add the "text" argument to setqflist(). (Yegappan Lakshmanan)
diff --git a/src/quickfix.c b/src/quickfix.c
index 79cb416..75b58af 100644
--- a/src/quickfix.c
+++ b/src/quickfix.c
@@ -4885,7 +4885,7 @@
}
static int
-qf_set_properties(qf_info_T *qi, dict_T *what, int action)
+qf_set_properties(qf_info_T *qi, dict_T *what, int action, char_u *title)
{
dictitem_T *di;
int retval = FAIL;
@@ -4929,7 +4929,7 @@
if (newlist)
{
- qf_new_list(qi, NULL);
+ qf_new_list(qi, title);
qf_idx = qi->qf_curlist;
}
@@ -4957,6 +4957,23 @@
}
}
+ if ((di = dict_find(what, (char_u *)"text", -1)) != NULL)
+ {
+ /* Only string and list values are supported */
+ if ((di->di_tv.v_type == VAR_STRING && di->di_tv.vval.v_string != NULL)
+ || (di->di_tv.v_type == VAR_LIST
+ && di->di_tv.vval.v_list != NULL))
+ {
+ if (action == 'r')
+ qf_free_items(qi, qf_idx);
+ if (qf_init_ext(qi, qf_idx, NULL, NULL, &di->di_tv, p_efm,
+ FALSE, (linenr_T)0, (linenr_T)0, NULL, NULL) > 0)
+ retval = OK;
+ }
+ else
+ return FAIL;
+ }
+
if ((di = dict_find(what, (char_u *)"context", -1)) != NULL)
{
typval_T *ctx;
@@ -5070,7 +5087,7 @@
qf_free_stack(wp, qi);
}
else if (what != NULL)
- retval = qf_set_properties(qi, what, action);
+ retval = qf_set_properties(qi, what, action, title);
else
retval = qf_add_entries(qi, qi->qf_curlist, list, title, action);