aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/quickfix.c
diff options
context:
space:
mode:
authorJan Edmund Lazo <janedmundlazo@hotmail.com>2018-09-06 23:49:21 -0400
committerJan Edmund Lazo <janedmundlazo@hotmail.com>2018-09-07 00:00:22 -0400
commitd99a2689143827fae19e2354d27287587f2059cb (patch)
tree82f7bf49e9813c6cc52ac11a6bc34a5890ac3732 /src/nvim/quickfix.c
parent4eb923bfe0658a03c53326ecc7fea4ca2b820e34 (diff)
downloadrneovim-d99a2689143827fae19e2354d27287587f2059cb.tar.gz
rneovim-d99a2689143827fae19e2354d27287587f2059cb.tar.bz2
rneovim-d99a2689143827fae19e2354d27287587f2059cb.zip
vim-patch:8.0.0922: quickfix list always added after current one
Problem: Quickfix list always added after current one. Solution: Make it possible to add a quickfix list after the last one. (Yegappan Lakshmanan) https://github.com/vim/vim/commit/55b6926450d75788dada3ff44a35e328224df758
Diffstat (limited to 'src/nvim/quickfix.c')
-rw-r--r--src/nvim/quickfix.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c
index fb60b60605..263b8b3a77 100644
--- a/src/nvim/quickfix.c
+++ b/src/nvim/quickfix.c
@@ -1198,9 +1198,9 @@ static void qf_store_title(qf_info_T *qi, int qf_idx, char_u *title)
}
}
-/*
- * Prepare for adding a new quickfix list.
- */
+// Prepare for adding a new quickfix list. If the current list is in the
+// middle of the stack, then all the following lists are freed and then
+// the new list is added.
static void qf_new_list(qf_info_T *qi, char_u *qf_title)
{
int i;
@@ -4351,24 +4351,31 @@ static int qf_set_properties(qf_info_T *qi, dict_T *what, int action,
if ((action == ' ' || action == 'a') && qf_idx == qi->qf_listcount) {
// When creating a new list, accept qf_idx pointing to the next
- // non-available list
+ // non-available list and add the new list at the end of the
+ // stack.
newlist = true;
+ qf_idx = qi->qf_listcount - 1;
} else if (qf_idx < 0 || qf_idx >= qi->qf_listcount) {
return FAIL;
- } else {
+ } else if (action != ' ') {
newlist = false; // use the specified list
}
} else if (di->di_tv.v_type == VAR_STRING
- && strequal((const char *)di->di_tv.vval.v_string, "$")
- && qi->qf_listcount > 0) {
- qf_idx = qi->qf_listcount - 1;
- newlist = false;
+ && strequal((const char *)di->di_tv.vval.v_string, "$")) {
+ if (qi->qf_listcount > 0) {
+ qf_idx = qi->qf_listcount - 1;
+ } else if (newlist) {
+ qf_idx = 0;
+ } else {
+ return FAIL;
+ }
} else {
return FAIL;
}
}
if (newlist) {
+ qi->qf_curlist = qf_idx;
qf_new_list(qi, title);
qf_idx = qi->qf_curlist;
}