Skip to content

Commit c154274

Browse files
committed
patch 7.4.2081
Problem: Line numbers in the error list are not always adjusted. Solution: Set b_has_qf_entry properly. (Yegappan Lakshmanan)
1 parent b869c0d commit c154274

4 files changed

Lines changed: 21 additions & 11 deletions

File tree

src/quickfix.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1408,7 +1408,8 @@ qf_add_entry(
14081408

14091409
qfp->qf_fnum = bufnum;
14101410
if (buf != NULL)
1411-
buf->b_has_qf_entry = TRUE;
1411+
buf->b_has_qf_entry |=
1412+
(qi == &ql_info) ? BUF_HAS_QF_ENTRY : BUF_HAS_LL_ENTRY;
14121413
}
14131414
else
14141415
qfp->qf_fnum = qf_get_fnum(qi, dir, fname);
@@ -1680,7 +1681,8 @@ qf_get_fnum(qf_info_T *qi, char_u *directory, char_u *fname)
16801681
if (buf == NULL)
16811682
return 0;
16821683

1683-
buf->b_has_qf_entry = TRUE;
1684+
buf->b_has_qf_entry =
1685+
(qi == &ql_info) ? BUF_HAS_QF_ENTRY : BUF_HAS_LL_ENTRY;
16841686
return buf->b_fnum;
16851687
}
16861688

@@ -2728,8 +2730,9 @@ qf_mark_adjust(
27282730
int idx;
27292731
qf_info_T *qi = &ql_info;
27302732
int found_one = FALSE;
2733+
int buf_has_flag = wp == NULL ? BUF_HAS_QF_ENTRY : BUF_HAS_LL_ENTRY;
27312734

2732-
if (!curbuf->b_has_qf_entry)
2735+
if (!(curbuf->b_has_qf_entry & buf_has_flag))
27332736
return;
27342737
if (wp != NULL)
27352738
{
@@ -2758,7 +2761,7 @@ qf_mark_adjust(
27582761
}
27592762

27602763
if (!found_one)
2761-
curbuf->b_has_qf_entry = FALSE;
2764+
curbuf->b_has_qf_entry &= ~buf_has_flag;
27622765
}
27632766

27642767
/*

src/structs.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1906,6 +1906,8 @@ struct file_buffer
19061906
#ifdef FEAT_QUICKFIX
19071907
char_u *b_p_bh; /* 'bufhidden' */
19081908
char_u *b_p_bt; /* 'buftype' */
1909+
#define BUF_HAS_QF_ENTRY 1
1910+
#define BUF_HAS_LL_ENTRY 2
19091911
int b_has_qf_entry;
19101912
#endif
19111913
int b_p_bl; /* 'buflisted' */

src/testdir/test_quickfix.vim

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1341,13 +1341,14 @@ function! Xadjust_qflnum(cchar)
13411341

13421342
enew | only
13431343

1344-
call s:create_test_file('Xqftestfile')
1345-
edit Xqftestfile
1344+
let fname = 'Xqftestfile' . a:cchar
1345+
call s:create_test_file(fname)
1346+
exe 'edit ' . fname
13461347

1347-
Xgetexpr ['Xqftestfile:5:Line5',
1348-
\ 'Xqftestfile:10:Line10',
1349-
\ 'Xqftestfile:15:Line15',
1350-
\ 'Xqftestfile:20:Line20']
1348+
Xgetexpr [fname . ':5:Line5',
1349+
\ fname . ':10:Line10',
1350+
\ fname . ':15:Line15',
1351+
\ fname . ':20:Line20']
13511352

13521353
6,14delete
13531354
call append(6, ['Buffer', 'Window'])
@@ -1359,11 +1360,13 @@ function! Xadjust_qflnum(cchar)
13591360
call assert_equal(13, l[3].lnum)
13601361

13611362
enew!
1362-
call delete('Xqftestfile')
1363+
call delete(fname)
13631364
endfunction
13641365

13651366
function! Test_adjust_lnum()
1367+
call setloclist(0, [])
13661368
call Xadjust_qflnum('c')
1369+
call setqflist([])
13671370
call Xadjust_qflnum('l')
13681371
endfunction
13691372

src/version.c

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

759759
static int included_patches[] =
760760
{ /* Add new patch number below this line */
761+
/**/
762+
2081,
761763
/**/
762764
2080,
763765
/**/

0 commit comments

Comments
 (0)