diff options
author | Jan Edmund Lazo <janedmundlazo@hotmail.com> | 2018-09-06 21:54:30 -0400 |
---|---|---|
committer | Jan Edmund Lazo <janedmundlazo@hotmail.com> | 2018-09-06 22:36:49 -0400 |
commit | 4eb923bfe0658a03c53326ecc7fea4ca2b820e34 (patch) | |
tree | 8d6aff22659b09428b5b04bd5d9e2e5db46bb349 /src/nvim/quickfix.c | |
parent | 2be853d486be2cac3b04efbf425afac2dd9361a3 (diff) | |
download | rneovim-4eb923bfe0658a03c53326ecc7fea4ca2b820e34.tar.gz rneovim-4eb923bfe0658a03c53326ecc7fea4ca2b820e34.tar.bz2 rneovim-4eb923bfe0658a03c53326ecc7fea4ca2b820e34.zip |
vim-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)
https://github.com/vim/vim/commit/ae338338508ef42866204f90dca861ac555f4298
Diffstat (limited to 'src/nvim/quickfix.c')
-rw-r--r-- | src/nvim/quickfix.c | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c index 1eb6b3b421..fb60b60605 100644 --- a/src/nvim/quickfix.c +++ b/src/nvim/quickfix.c @@ -4330,7 +4330,8 @@ static int qf_add_entries(qf_info_T *qi, int qf_idx, list_T *list, return retval; } -static int qf_set_properties(qf_info_T *qi, dict_T *what, int action) +static int qf_set_properties(qf_info_T *qi, dict_T *what, int action, + char_u *title) { dictitem_T *di; int retval = FAIL; @@ -4368,7 +4369,7 @@ static int 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; } @@ -4393,6 +4394,24 @@ static int qf_set_properties(qf_info_T *qi, dict_T *what, int action) } } + if ((di = tv_dict_find(what, S_LEN("text"))) != 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 = tv_dict_find(what, S_LEN("context"))) != NULL) { tv_free(qi->qf_lists[qf_idx].qf_ctx); @@ -4480,7 +4499,7 @@ int set_errorlist(win_T *wp, list_T *list, int action, char_u *title, // Free the entire quickfix or location list stack 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); } |