vim-patch:8.0.1040: cannot use another error format in getqflist()

Problem:    Cannot use another error format in getqflist().
Solution:   Add the "efm" argument to getqflist(). (Yegappan Lakshmanan)
3653822546
This commit is contained in:
Jan Edmund Lazo
2018-09-08 11:37:59 -04:00
parent a8b996160d
commit 3794e83d98
3 changed files with 57 additions and 9 deletions

View File

@@ -4122,18 +4122,30 @@ enum {
};
// Parse text from 'di' and return the quickfix list items
static int qf_get_list_from_lines(dictitem_T *di, dict_T *retdict)
static int qf_get_list_from_lines(dict_T *what, dictitem_T *di, dict_T *retdict)
{
int status = FAIL;
char_u *errorformat = p_efm;
dictitem_T *efm_di;
// Only a List value is supported
if (di->di_tv.v_type == VAR_LIST && di->di_tv.vval.v_list != NULL) {
// If errorformat is supplied then use it, otherwise use the 'efm'
// option setting
if ((efm_di = tv_dict_find(what, S_LEN("efm"))) != NULL) {
if (efm_di->di_tv.v_type != VAR_STRING
|| efm_di->di_tv.vval.v_string == NULL) {
return FAIL;
}
errorformat = efm_di->di_tv.vval.v_string;
}
list_T *l = tv_list_alloc(kListLenMayKnow);
qf_info_T *qi = xmalloc(sizeof(*qi));
memset(qi, 0, sizeof(*qi));
qi->qf_refcount++;
if (qf_init_ext(qi, 0, NULL, NULL, &di->di_tv, p_efm,
if (qf_init_ext(qi, 0, NULL, NULL, &di->di_tv, errorformat,
true, (linenr_T)0, (linenr_T)0, NULL, NULL) > 0) {
(void)get_errorlist(qi, NULL, 0, l);
qf_free(qi, 0);
@@ -4156,7 +4168,7 @@ int get_errorlist_properties(win_T *wp, dict_T *what, dict_T *retdict)
dictitem_T *di;
if ((di = tv_dict_find(what, S_LEN("lines"))) != NULL) {
return qf_get_list_from_lines(di, retdict);
return qf_get_list_from_lines(what, di, retdict);
}
if (wp != NULL) {
@@ -4390,6 +4402,7 @@ static int qf_set_properties(qf_info_T *qi, dict_T *what, int action,
dictitem_T *di;
int retval = FAIL;
int newlist = false;
char_u *errorformat = p_efm;
if (action == ' ' || qi->qf_curlist == qi->qf_listcount) {
newlist = true;
@@ -4471,13 +4484,20 @@ static int qf_set_properties(qf_info_T *qi, dict_T *what, int action,
}
}
if ((di = tv_dict_find(what, S_LEN("efm"))) != NULL) {
if (di->di_tv.v_type != VAR_STRING || di->di_tv.vval.v_string == NULL) {
return FAIL;
}
errorformat = di->di_tv.vval.v_string;
}
if ((di = tv_dict_find(what, S_LEN("lines"))) != NULL) {
// Only a List value is supported
if (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,
if (qf_init_ext(qi, qf_idx, NULL, NULL, &di->di_tv, errorformat,
false, (linenr_T)0, (linenr_T)0, NULL, NULL) > 0) {
retval = OK;
}