summaryrefslogtreecommitdiff
path: root/src/quickfix.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-08-11 20:25:26 +0200
committerBram Moolenaar <Bram@vim.org>2017-08-11 20:25:26 +0200
commitae338338508ef42866204f90dca861ac555f4298 (patch)
tree149ce5eb4d1f3062c49a4a7344830d7f67aa1515 /src/quickfix.c
parentcf8d840ce9140931bfbdc97961dad9278ee5f96c (diff)
downloadvim-ae338338508ef42866204f90dca861ac555f4298.zip
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)
Diffstat (limited to 'src/quickfix.c')
-rw-r--r--src/quickfix.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/src/quickfix.c b/src/quickfix.c
index 79cb4168d..75b58af3b 100644
--- a/src/quickfix.c
+++ b/src/quickfix.c
@@ -4885,7 +4885,7 @@ qf_add_entries(
}
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 @@ qf_set_properties(qf_info_T *qi, dict_T *what, int action)
if (newlist)
{
- qf_new_list(qi, NULL);
+ qf_new_list(qi, title);
qf_idx = qi->qf_curlist;
}
@@ -4957,6 +4957,23 @@ qf_set_properties(qf_info_T *qi, dict_T *what, int action)
}
}
+ 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 @@ set_errorlist(
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);