aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/quickfix.c
diff options
context:
space:
mode:
authorJames McCoy <jamessan@jamessan.com>2017-12-18 14:26:49 -0500
committerJames McCoy <jamessan@jamessan.com>2017-12-18 14:35:55 -0500
commitfb8592b7ba673f230f144dc8c29e5dffc33fc50a (patch)
treec166a68801d1362a30fe3fa43d6ab9e76ec91d3f /src/nvim/quickfix.c
parent6b5d92f9e0e9754933abec06e9265027f388357f (diff)
downloadrneovim-fb8592b7ba673f230f144dc8c29e5dffc33fc50a.tar.gz
rneovim-fb8592b7ba673f230f144dc8c29e5dffc33fc50a.tar.bz2
rneovim-fb8592b7ba673f230f144dc8c29e5dffc33fc50a.zip
vim-patch:8.0.0517: there is no way to remove quickfix lists
Problem: There is no way to remove quickfix lists (for testing). Solution: Add the 'f' action to setqflist(). Add tests. (Yegappan Lakshmanan) https://github.com/vim/vim/commit/b6fa30ccc39cdb7f1d07b99fe2f4c6b61671dac2
Diffstat (limited to 'src/nvim/quickfix.c')
-rw-r--r--src/nvim/quickfix.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c
index 6d59d15515..c7326c46fe 100644
--- a/src/nvim/quickfix.c
+++ b/src/nvim/quickfix.c
@@ -4267,6 +4267,16 @@ static int qf_set_properties(qf_info_T *qi, dict_T *what, int action)
return retval;
}
+static void qf_free_stack(win_T *wp, qf_info_T *qi)
+{
+ qf_free_all(wp);
+ if (wp == NULL) {
+ // quickfix list
+ qi->qf_curlist = 0;
+ qi->qf_listcount = 0;
+ }
+}
+
// Populate the quickfix list with the items supplied in the list
// of dictionaries. "title" will be copied to w:quickfix_title
// "action" is 'a' for add, 'r' for replace. Otherwise create a new list.
@@ -4280,7 +4290,10 @@ int set_errorlist(win_T *wp, list_T *list, int action, char_u *title,
qi = ll_get_or_alloc_list(wp);
}
- if (what != NULL) {
+ if (action == 'f') {
+ // Free the entire quickfix or location list stack
+ qf_free_stack(wp, qi);
+ } else if (what != NULL) {
retval = qf_set_properties(qi, what, action);
} else {
retval = qf_add_entries(qi, list, title, action);