summaryrefslogtreecommitdiff
path: root/src/quickfix.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-04-18 20:04:00 +0200
committerBram Moolenaar <Bram@vim.org>2016-04-18 20:04:00 +0200
commitc1808d5822ed9534ef7f0fe509b15bee92a5cc28 (patch)
tree39648a3110add263f6240e7523ee4776cacda14c /src/quickfix.c
parentdef5abe0a2727041ecee69afdccfca405333bd24 (diff)
downloadvim-c1808d5822ed9534ef7f0fe509b15bee92a5cc28.zip
patch 7.4.1752
Problem: When adding to the quickfix list the current position is reset. Solution: Do not reset the position when not needed. (Yegappan Lakshmanan)
Diffstat (limited to 'src/quickfix.c')
-rw-r--r--src/quickfix.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/src/quickfix.c b/src/quickfix.c
index 00762bda4..510d8ddcb 100644
--- a/src/quickfix.c
+++ b/src/quickfix.c
@@ -126,7 +126,7 @@ static int qf_win_pos_update(qf_info_T *qi, int old_qf_index);
static int is_qf_win(win_T *win, qf_info_T *qi);
static win_T *qf_find_win(qf_info_T *qi);
static buf_T *qf_find_buf(qf_info_T *qi);
-static void qf_update_buffer(qf_info_T *qi);
+static void qf_update_buffer(qf_info_T *qi, int update_cursor);
static void qf_set_title_var(qf_info_T *qi);
static void qf_fill_buffer(qf_info_T *qi);
#endif
@@ -880,7 +880,7 @@ qf_init_end:
vim_free(fmtstr);
#ifdef FEAT_WINDOWS
- qf_update_buffer(qi);
+ qf_update_buffer(qi, TRUE);
#endif
return retval;
@@ -2176,7 +2176,7 @@ qf_msg(qf_info_T *qi)
qi->qf_curlist + 1, qi->qf_listcount,
qi->qf_lists[qi->qf_curlist].qf_count);
#ifdef FEAT_WINDOWS
- qf_update_buffer(qi);
+ qf_update_buffer(qi, TRUE);
#endif
}
@@ -2606,7 +2606,7 @@ qf_find_buf(qf_info_T *qi)
* Find the quickfix buffer. If it exists, update the contents.
*/
static void
-qf_update_buffer(qf_info_T *qi)
+qf_update_buffer(qf_info_T *qi, int update_cursor)
{
buf_T *buf;
win_T *win;
@@ -2633,7 +2633,8 @@ qf_update_buffer(qf_info_T *qi)
/* restore curwin/curbuf and a few other things */
aucmd_restbuf(&aco);
- (void)qf_win_pos_update(qi, 0);
+ if (update_cursor)
+ (void)qf_win_pos_update(qi, 0);
}
}
@@ -3675,7 +3676,7 @@ ex_vimgrep(exarg_T *eap)
qi->qf_lists[qi->qf_curlist].qf_index = 1;
#ifdef FEAT_WINDOWS
- qf_update_buffer(qi);
+ qf_update_buffer(qi, TRUE);
#endif
#ifdef FEAT_AUTOCMD
@@ -4115,12 +4116,16 @@ set_errorlist(
qi->qf_lists[qi->qf_curlist].qf_nonevalid = TRUE;
else
qi->qf_lists[qi->qf_curlist].qf_nonevalid = FALSE;
- qi->qf_lists[qi->qf_curlist].qf_ptr = qi->qf_lists[qi->qf_curlist].qf_start;
- if (qi->qf_lists[qi->qf_curlist].qf_count > 0)
- qi->qf_lists[qi->qf_curlist].qf_index = 1;
+ if (action != 'a') {
+ qi->qf_lists[qi->qf_curlist].qf_ptr =
+ qi->qf_lists[qi->qf_curlist].qf_start;
+ if (qi->qf_lists[qi->qf_curlist].qf_count > 0)
+ qi->qf_lists[qi->qf_curlist].qf_index = 1;
+ }
#ifdef FEAT_WINDOWS
- qf_update_buffer(qi);
+ /* Don't update the cursor in quickfix window when appending entries */
+ qf_update_buffer(qi, (action != 'a'));
#endif
return retval;
@@ -4427,7 +4432,7 @@ ex_helpgrep(exarg_T *eap)
free_string_option(save_cpo);
#ifdef FEAT_WINDOWS
- qf_update_buffer(qi);
+ qf_update_buffer(qi, TRUE);
#endif
#ifdef FEAT_AUTOCMD