Skip to content

Commit 2ce7790

Browse files
committed
patch 8.2.1982: quickfix window now updated when adding invalid entries
Problem: Quickfix window now updated when adding invalid entries. Solution: Update the quickfix buffer properly. (Yegappan Lakshmanan, closes #7291, closes #7271)
1 parent 8496c9e commit 2ce7790

3 files changed

Lines changed: 20 additions & 2 deletions

File tree

src/quickfix.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4674,14 +4674,17 @@ qf_fill_buffer(qf_list_T *qfl, buf_T *buf, qfline_T *old_last, int qf_winid)
46744674
*dirname = NUL;
46754675

46764676
// Add one line for each error
4677-
if (old_last == NULL || old_last->qf_next == NULL)
4677+
if (old_last == NULL)
46784678
{
46794679
qfp = qfl->qf_start;
46804680
lnum = 0;
46814681
}
46824682
else
46834683
{
4684-
qfp = old_last->qf_next;
4684+
if (old_last->qf_next != NULL)
4685+
qfp = old_last->qf_next;
4686+
else
4687+
qfp = old_last;
46854688
lnum = buf->b_ml.ml_line_count;
46864689
}
46874690

src/testdir/test_quickfix.vim

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5145,4 +5145,17 @@ func Test_setloclist_crash()
51455145
%bw!
51465146
endfunc
51475147

5148+
" Test for adding an invalid entry with the quickfix window open and making
5149+
" sure that the window contents are not changed
5150+
func Test_add_invalid_entry_with_qf_window()
5151+
call setqflist([], 'f')
5152+
cexpr "Xfile1:10:aa"
5153+
copen
5154+
call setqflist(['bb'], 'a')
5155+
call assert_equal(1, line('$'))
5156+
call assert_equal(['Xfile1|10| aa'], getline(1, '$'))
5157+
call assert_equal([{'lnum': 10, 'bufnr': bufnr('Xfile1'), 'col': 0, 'pattern': '', 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'module': '', 'text': 'aa'}], getqflist())
5158+
cclose
5159+
endfunc
5160+
51485161
" vim: shiftwidth=2 sts=2 expandtab

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,8 @@ static char *(features[]) =
750750

751751
static int included_patches[] =
752752
{ /* Add new patch number below this line */
753+
/**/
754+
1982,
753755
/**/
754756
1981,
755757
/**/

0 commit comments

Comments
 (0)