Mercurial > vim
comparison src/quickfix.c @ 8932:25c2031e9f9f v7.4.1752
commit https://github.com/vim/vim/commit/c1808d5822ed9534ef7f0fe509b15bee92a5cc28
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Apr 18 20:04:00 2016 +0200
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)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Mon, 18 Apr 2016 20:15:05 +0200 |
parents | 7f974075eb8f |
children | 0536d1469b67 |
comparison
equal
deleted
inserted
replaced
8931:20af5157c7f4 | 8932:25c2031e9f9f |
---|---|
124 #ifdef FEAT_WINDOWS | 124 #ifdef FEAT_WINDOWS |
125 static int qf_win_pos_update(qf_info_T *qi, int old_qf_index); | 125 static int qf_win_pos_update(qf_info_T *qi, int old_qf_index); |
126 static int is_qf_win(win_T *win, qf_info_T *qi); | 126 static int is_qf_win(win_T *win, qf_info_T *qi); |
127 static win_T *qf_find_win(qf_info_T *qi); | 127 static win_T *qf_find_win(qf_info_T *qi); |
128 static buf_T *qf_find_buf(qf_info_T *qi); | 128 static buf_T *qf_find_buf(qf_info_T *qi); |
129 static void qf_update_buffer(qf_info_T *qi); | 129 static void qf_update_buffer(qf_info_T *qi, int update_cursor); |
130 static void qf_set_title_var(qf_info_T *qi); | 130 static void qf_set_title_var(qf_info_T *qi); |
131 static void qf_fill_buffer(qf_info_T *qi); | 131 static void qf_fill_buffer(qf_info_T *qi); |
132 #endif | 132 #endif |
133 static char_u *get_mef_name(void); | 133 static char_u *get_mef_name(void); |
134 static void restore_start_dir(char_u *dirname_start); | 134 static void restore_start_dir(char_u *dirname_start); |
878 vim_free(errmsg); | 878 vim_free(errmsg); |
879 vim_free(pattern); | 879 vim_free(pattern); |
880 vim_free(fmtstr); | 880 vim_free(fmtstr); |
881 | 881 |
882 #ifdef FEAT_WINDOWS | 882 #ifdef FEAT_WINDOWS |
883 qf_update_buffer(qi); | 883 qf_update_buffer(qi, TRUE); |
884 #endif | 884 #endif |
885 | 885 |
886 return retval; | 886 return retval; |
887 } | 887 } |
888 | 888 |
2174 { | 2174 { |
2175 smsg((char_u *)_("error list %d of %d; %d errors"), | 2175 smsg((char_u *)_("error list %d of %d; %d errors"), |
2176 qi->qf_curlist + 1, qi->qf_listcount, | 2176 qi->qf_curlist + 1, qi->qf_listcount, |
2177 qi->qf_lists[qi->qf_curlist].qf_count); | 2177 qi->qf_lists[qi->qf_curlist].qf_count); |
2178 #ifdef FEAT_WINDOWS | 2178 #ifdef FEAT_WINDOWS |
2179 qf_update_buffer(qi); | 2179 qf_update_buffer(qi, TRUE); |
2180 #endif | 2180 #endif |
2181 } | 2181 } |
2182 | 2182 |
2183 /* | 2183 /* |
2184 * Free error list "idx". | 2184 * Free error list "idx". |
2604 | 2604 |
2605 /* | 2605 /* |
2606 * Find the quickfix buffer. If it exists, update the contents. | 2606 * Find the quickfix buffer. If it exists, update the contents. |
2607 */ | 2607 */ |
2608 static void | 2608 static void |
2609 qf_update_buffer(qf_info_T *qi) | 2609 qf_update_buffer(qf_info_T *qi, int update_cursor) |
2610 { | 2610 { |
2611 buf_T *buf; | 2611 buf_T *buf; |
2612 win_T *win; | 2612 win_T *win; |
2613 win_T *curwin_save; | 2613 win_T *curwin_save; |
2614 aco_save_T aco; | 2614 aco_save_T aco; |
2631 qf_fill_buffer(qi); | 2631 qf_fill_buffer(qi); |
2632 | 2632 |
2633 /* restore curwin/curbuf and a few other things */ | 2633 /* restore curwin/curbuf and a few other things */ |
2634 aucmd_restbuf(&aco); | 2634 aucmd_restbuf(&aco); |
2635 | 2635 |
2636 (void)qf_win_pos_update(qi, 0); | 2636 if (update_cursor) |
2637 (void)qf_win_pos_update(qi, 0); | |
2637 } | 2638 } |
2638 } | 2639 } |
2639 | 2640 |
2640 /* | 2641 /* |
2641 * Set "w:quickfix_title" if "qi" has a title. | 2642 * Set "w:quickfix_title" if "qi" has a title. |
3673 qi->qf_lists[qi->qf_curlist].qf_nonevalid = FALSE; | 3674 qi->qf_lists[qi->qf_curlist].qf_nonevalid = FALSE; |
3674 qi->qf_lists[qi->qf_curlist].qf_ptr = qi->qf_lists[qi->qf_curlist].qf_start; | 3675 qi->qf_lists[qi->qf_curlist].qf_ptr = qi->qf_lists[qi->qf_curlist].qf_start; |
3675 qi->qf_lists[qi->qf_curlist].qf_index = 1; | 3676 qi->qf_lists[qi->qf_curlist].qf_index = 1; |
3676 | 3677 |
3677 #ifdef FEAT_WINDOWS | 3678 #ifdef FEAT_WINDOWS |
3678 qf_update_buffer(qi); | 3679 qf_update_buffer(qi, TRUE); |
3679 #endif | 3680 #endif |
3680 | 3681 |
3681 #ifdef FEAT_AUTOCMD | 3682 #ifdef FEAT_AUTOCMD |
3682 if (au_name != NULL) | 3683 if (au_name != NULL) |
3683 apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name, | 3684 apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name, |
4113 if (qi->qf_lists[qi->qf_curlist].qf_index == 0) | 4114 if (qi->qf_lists[qi->qf_curlist].qf_index == 0) |
4114 /* no valid entry */ | 4115 /* no valid entry */ |
4115 qi->qf_lists[qi->qf_curlist].qf_nonevalid = TRUE; | 4116 qi->qf_lists[qi->qf_curlist].qf_nonevalid = TRUE; |
4116 else | 4117 else |
4117 qi->qf_lists[qi->qf_curlist].qf_nonevalid = FALSE; | 4118 qi->qf_lists[qi->qf_curlist].qf_nonevalid = FALSE; |
4118 qi->qf_lists[qi->qf_curlist].qf_ptr = qi->qf_lists[qi->qf_curlist].qf_start; | 4119 if (action != 'a') { |
4119 if (qi->qf_lists[qi->qf_curlist].qf_count > 0) | 4120 qi->qf_lists[qi->qf_curlist].qf_ptr = |
4120 qi->qf_lists[qi->qf_curlist].qf_index = 1; | 4121 qi->qf_lists[qi->qf_curlist].qf_start; |
4122 if (qi->qf_lists[qi->qf_curlist].qf_count > 0) | |
4123 qi->qf_lists[qi->qf_curlist].qf_index = 1; | |
4124 } | |
4121 | 4125 |
4122 #ifdef FEAT_WINDOWS | 4126 #ifdef FEAT_WINDOWS |
4123 qf_update_buffer(qi); | 4127 /* Don't update the cursor in quickfix window when appending entries */ |
4128 qf_update_buffer(qi, (action != 'a')); | |
4124 #endif | 4129 #endif |
4125 | 4130 |
4126 return retval; | 4131 return retval; |
4127 } | 4132 } |
4128 #endif | 4133 #endif |
4425 else | 4430 else |
4426 /* Darn, some plugin changed the value. */ | 4431 /* Darn, some plugin changed the value. */ |
4427 free_string_option(save_cpo); | 4432 free_string_option(save_cpo); |
4428 | 4433 |
4429 #ifdef FEAT_WINDOWS | 4434 #ifdef FEAT_WINDOWS |
4430 qf_update_buffer(qi); | 4435 qf_update_buffer(qi, TRUE); |
4431 #endif | 4436 #endif |
4432 | 4437 |
4433 #ifdef FEAT_AUTOCMD | 4438 #ifdef FEAT_AUTOCMD |
4434 if (au_name != NULL) | 4439 if (au_name != NULL) |
4435 { | 4440 { |