diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/buffer_defs.h | 5 | ||||
-rw-r--r-- | src/nvim/quickfix.c | 11 | ||||
-rw-r--r-- | src/nvim/testdir/test_quickfix.vim | 17 | ||||
-rw-r--r-- | src/nvim/version.c | 2 |
4 files changed, 22 insertions, 13 deletions
diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h index 2b66a07f48..29f4dfe4fb 100644 --- a/src/nvim/buffer_defs.h +++ b/src/nvim/buffer_defs.h @@ -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' diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c index 9a4d413358..19287ecffb 100644 --- a/src/nvim/quickfix.c +++ b/src/nvim/quickfix.c @@ -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; } } diff --git a/src/nvim/testdir/test_quickfix.vim b/src/nvim/testdir/test_quickfix.vim index 008cc6c11b..7464a11abd 100644 --- a/src/nvim/testdir/test_quickfix.vim +++ b/src/nvim/testdir/test_quickfix.vim @@ -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 diff --git a/src/nvim/version.c b/src/nvim/version.c index 9f801be548..3bf87da376 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -359,7 +359,7 @@ static int included_patches[] = { // 2084, // 2083, // 2082, - // 2081, + 2081, // 2080, // 2079 NA // 2078 NA |