vim-patch:7.4.2081

Problem:    Line numbers in the error list are not always adjusted.
Solution:   Set b_has_qf_entry properly. (Yegappan Lakshmanan)

c1542744e7
This commit is contained in:
lonerover 2017-01-18 12:13:51 +08:00
parent 86f76108f7
commit 0060974b2b
4 changed files with 22 additions and 13 deletions

View File

@ -454,6 +454,9 @@ typedef struct {
} synblock_T;
#define BUF_HAS_QF_ENTRY 1
#define BUF_HAS_LL_ENTRY 2
/*
* buffer: structure that holds information about one file
*
@ -611,7 +614,7 @@ struct file_buffer {
int b_p_bomb; ///< 'bomb'
char_u *b_p_bh; ///< 'bufhidden'
char_u *b_p_bt; ///< 'buftype'
bool b_has_qf_entry; ///< quickfix exists for buffer
int b_has_qf_entry; ///< quickfix exists for buffer
int b_p_bl; ///< 'buflisted'
int b_p_cin; ///< 'cindent'
char_u *b_p_cino; ///< 'cinoptions'

View File

@ -1105,7 +1105,8 @@ static int qf_add_entry(qf_info_T *qi, char_u *dir, char_u *fname, int bufnum,
qfp->qf_fnum = bufnum;
if (buf != NULL) {
buf->b_has_qf_entry = true;
buf->b_has_qf_entry |=
(qi == &ql_info) ? BUF_HAS_QF_ENTRY : BUF_HAS_LL_ENTRY;
}
} else {
qfp->qf_fnum = qf_get_fnum(qi, dir, fname);
@ -1322,7 +1323,8 @@ static int qf_get_fnum(qf_info_T *qi, char_u *directory, char_u *fname)
if (buf == NULL) {
return 0;
}
buf->b_has_qf_entry = true;
buf->b_has_qf_entry =
(qi == &ql_info) ? BUF_HAS_QF_ENTRY : BUF_HAS_LL_ENTRY;
return buf->b_fnum;
}
@ -2239,8 +2241,9 @@ void qf_mark_adjust(win_T *wp, linenr_T line1, linenr_T line2, long amount, long
int idx;
qf_info_T *qi = &ql_info;
bool found_one = false;
int buf_has_flag = wp == NULL ? BUF_HAS_QF_ENTRY : BUF_HAS_LL_ENTRY;
if (!curbuf->b_has_qf_entry) {
if (!(curbuf->b_has_qf_entry & buf_has_flag)) {
return;
}
if (wp != NULL) {
@ -2267,7 +2270,7 @@ void qf_mark_adjust(win_T *wp, linenr_T line1, linenr_T line2, long amount, long
}
if (!found_one) {
curbuf->b_has_qf_entry = false;
curbuf->b_has_qf_entry &= ~buf_has_flag;
}
}

View File

@ -1299,13 +1299,14 @@ function! Xadjust_qflnum(cchar)
enew | only
call s:create_test_file('Xqftestfile')
edit Xqftestfile
let fname = 'Xqftestfile' . a:cchar
call s:create_test_file(fname)
exe 'edit ' . fname
Xgetexpr ['Xqftestfile:5:Line5',
\ 'Xqftestfile:10:Line10',
\ 'Xqftestfile:15:Line15',
\ 'Xqftestfile:20:Line20']
Xgetexpr [fname . ':5:Line5',
\ fname . ':10:Line10',
\ fname . ':15:Line15',
\ fname . ':20:Line20']
6,14delete
call append(6, ['Buffer', 'Window'])
@ -1317,11 +1318,13 @@ function! Xadjust_qflnum(cchar)
call assert_equal(13, l[3].lnum)
enew!
call delete('Xqftestfile')
call delete(fname)
endfunction
function! Test_adjust_lnum()
call setloclist(0, [])
call Xadjust_qflnum('c')
call setqflist([])
call Xadjust_qflnum('l')
endfunction

View File

@ -359,7 +359,7 @@ static int included_patches[] = {
// 2084,
// 2083,
// 2082,
// 2081,
2081,
// 2080,
// 2079 NA
// 2078 NA