Hi, On Mon, Jul 18, 2016 at 5:21 PM, Yegappan Lakshmanan <[email protected]> wrote: > Hi, > > When a buffer is modified (lines are added/removed), the line numbers > in the quickfix list are updated to reflect the new line numbers > using the qf_mark_adjust() function. > > This functionality is broken with the recent changes made to optimize > this update (curbuf->b_has_qf_entry). This happens when a quickfix list > and an empty location list are used. The qf_mark_adjust() function sets > the b_has_qf_entry flag to FALSE if a quickfix entry is not found. But > this function is called for both a quickfix list and the location list > to adjust the line numbers. If any one of the list is empty, then this > flag will be set to FALSE. After this, further modifications to the > buffer will not update the line numbers. Should we use two separate > flags (one for the quickfix list and the other for the location list?) > > I created the following test function to illustrate the problem: > > function! Test_Qf_Mark_Adjust() > let l = [] > for i in range(1, 20) > call add(l, 'Line' . i) > endfor > call writefile(l, 'Xqftestfile') > > call setloclist(0, []) > > edit Xqftestfile > > cgetexpr ['Xqftestfile:5:Line5', > \ 'Xqftestfile:10:Line10', > \ 'Xqftestfile:15:Line15', > \ 'Xqftestfile:20:Line20'] > > 6,14delete > call append(6, ['Buffer', 'Window']) > > let l = getqflist() > > call assert_equal(5, l[0].lnum) > call assert_equal(6, l[2].lnum) > call assert_equal(13, l[3].lnum) > > enew! > call delete('Xqftestfile') > endfunction >
The above test function is already part of test_quickfix.vim (Xadjust_qflnum) except for the line that sets the empty location list. The current test is not catching this problem because the Test_adjust_lnum() is the first test that gets executed. When this test executes there are no previous location lists. I ran into this problem when I added a test that created an empty location list and executed before Test_adjust_lnum(). - Yegappan -- -- 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.
