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)
Files: src/quickfix.c, src/testdir/test_quickfix.vim
*** ../vim-7.4.1751/src/quickfix.c 2016-03-27 18:44:36.823626960 +0200
--- src/quickfix.c 2016-04-18 20:01:49.956798364 +0200
***************
*** 126,132 ****
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_set_title_var(qf_info_T *qi);
static void qf_fill_buffer(qf_info_T *qi);
#endif
--- 126,132 ----
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, int update_cursor);
static void qf_set_title_var(qf_info_T *qi);
static void qf_fill_buffer(qf_info_T *qi);
#endif
***************
*** 880,886 ****
vim_free(fmtstr);
#ifdef FEAT_WINDOWS
! qf_update_buffer(qi);
#endif
return retval;
--- 880,886 ----
vim_free(fmtstr);
#ifdef FEAT_WINDOWS
! qf_update_buffer(qi, TRUE);
#endif
return retval;
***************
*** 2176,2182 ****
qi->qf_curlist + 1, qi->qf_listcount,
qi->qf_lists[qi->qf_curlist].qf_count);
#ifdef FEAT_WINDOWS
! qf_update_buffer(qi);
#endif
}
--- 2176,2182 ----
qi->qf_curlist + 1, qi->qf_listcount,
qi->qf_lists[qi->qf_curlist].qf_count);
#ifdef FEAT_WINDOWS
! qf_update_buffer(qi, TRUE);
#endif
}
***************
*** 2606,2612 ****
* Find the quickfix buffer. If it exists, update the contents.
*/
static void
! qf_update_buffer(qf_info_T *qi)
{
buf_T *buf;
win_T *win;
--- 2606,2612 ----
* Find the quickfix buffer. If it exists, update the contents.
*/
static void
! qf_update_buffer(qf_info_T *qi, int update_cursor)
{
buf_T *buf;
win_T *win;
***************
*** 2633,2639 ****
/* restore curwin/curbuf and a few other things */
aucmd_restbuf(&aco);
! (void)qf_win_pos_update(qi, 0);
}
}
--- 2633,2640 ----
/* restore curwin/curbuf and a few other things */
aucmd_restbuf(&aco);
! if (update_cursor)
! (void)qf_win_pos_update(qi, 0);
}
}
***************
*** 3675,3681 ****
qi->qf_lists[qi->qf_curlist].qf_index = 1;
#ifdef FEAT_WINDOWS
! qf_update_buffer(qi);
#endif
#ifdef FEAT_AUTOCMD
--- 3676,3682 ----
qi->qf_lists[qi->qf_curlist].qf_index = 1;
#ifdef FEAT_WINDOWS
! qf_update_buffer(qi, TRUE);
#endif
#ifdef FEAT_AUTOCMD
***************
*** 4115,4126 ****
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;
#ifdef FEAT_WINDOWS
! qf_update_buffer(qi);
#endif
return retval;
--- 4116,4131 ----
qi->qf_lists[qi->qf_curlist].qf_nonevalid = TRUE;
else
qi->qf_lists[qi->qf_curlist].qf_nonevalid = FALSE;
! 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
! /* Don't update the cursor in quickfix window when appending entries */
! qf_update_buffer(qi, (action != 'a'));
#endif
return retval;
***************
*** 4427,4433 ****
free_string_option(save_cpo);
#ifdef FEAT_WINDOWS
! qf_update_buffer(qi);
#endif
#ifdef FEAT_AUTOCMD
--- 4432,4438 ----
free_string_option(save_cpo);
#ifdef FEAT_WINDOWS
! qf_update_buffer(qi, TRUE);
#endif
#ifdef FEAT_AUTOCMD
*** ../vim-7.4.1751/src/testdir/test_quickfix.vim 2016-03-27
18:44:36.827626918 +0200
--- src/testdir/test_quickfix.vim 2016-04-18 20:01:04.313268630 +0200
***************
*** 697,699 ****
--- 697,747 ----
" this must not crash Vim
cgetexpr [$x]
endfunc
+
+ " Tests for the setqflist() and setloclist() functions
+ function SetXlistTests(cchar, bnum)
+ if a:cchar == 'c'
+ let Xsetlist = function('setqflist')
+ let Xgetlist = function('getqflist')
+ let Xnext = 'cnext'
+ else
+ let Xsetlist = function('setloclist', [0])
+ let Xgetlist = function('getloclist', [0])
+ let Xnext = 'lnext'
+ endif
+
+ call Xsetlist([{'bufnr': a:bnum, 'lnum': 1},
+ \ {'bufnr': a:bnum, 'lnum': 2}])
+ let l = Xgetlist()
+ call assert_equal(2, len(l))
+ call assert_equal(2, l[1].lnum)
+
+ exe Xnext
+ call Xsetlist([{'bufnr': a:bnum, 'lnum': 3}], 'a')
+ let l = Xgetlist()
+ call assert_equal(3, len(l))
+ exe Xnext
+ call assert_equal(3, line('.'))
+
+ call Xsetlist([{'bufnr': a:bnum, 'lnum': 3},
+ \ {'bufnr': a:bnum, 'lnum': 4},
+ \ {'bufnr': a:bnum, 'lnum': 5}], 'r')
+ let l = Xgetlist()
+ call assert_equal(3, len(l))
+ call assert_equal(5, l[2].lnum)
+
+ call Xsetlist([])
+ let l = Xgetlist()
+ call assert_equal(0, len(l))
+ endfunction
+
+ function Test_setqflist()
+ new Xtestfile | only
+ let bnum = bufnr('%')
+ call setline(1, range(1,5))
+
+ call SetXlistTests('c', bnum)
+ call SetXlistTests('l', bnum)
+
+ call delete('Xtestfile')
+ endfunction
*** ../vim-7.4.1751/src/version.c 2016-04-18 19:45:13.463066926 +0200
--- src/version.c 2016-04-18 20:03:12.779945047 +0200
***************
*** 750,751 ****
--- 750,753 ----
{ /* Add new patch number below this line */
+ /**/
+ 1752,
/**/
--
Not too long ago, unzipping in public was illegal...
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.