To: vim_dev@googlegroups.com Subject: Patch 7.4.2081 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 7.4.2081 Problem: Line numbers in the error list are not always adjusted. Solution: Set b_has_qf_entry properly. (Yegappan Lakshmanan) Files: src/quickfix.c, src/structs.h, src/testdir/test_quickfix.vim *** ../vim-7.4.2080/src/quickfix.c 2016-07-18 22:22:34.980686625 +0200 --- src/quickfix.c 2016-07-20 21:43:29.794791155 +0200 *************** *** 1408,1414 **** qfp->qf_fnum = bufnum; if (buf != NULL) ! buf->b_has_qf_entry = TRUE; } else qfp->qf_fnum = qf_get_fnum(qi, dir, fname); --- 1408,1415 ---- qfp->qf_fnum = bufnum; if (buf != NULL) ! 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); *************** *** 1680,1686 **** if (buf == NULL) return 0; ! buf->b_has_qf_entry = TRUE; return buf->b_fnum; } --- 1681,1688 ---- if (buf == NULL) return 0; ! buf->b_has_qf_entry = ! (qi == &ql_info) ? BUF_HAS_QF_ENTRY : BUF_HAS_LL_ENTRY; return buf->b_fnum; } *************** *** 2728,2735 **** int idx; qf_info_T *qi = &ql_info; int found_one = FALSE; ! if (!curbuf->b_has_qf_entry) return; if (wp != NULL) { --- 2730,2738 ---- int idx; qf_info_T *qi = &ql_info; int found_one = FALSE; + int buf_has_flag = wp == NULL ? BUF_HAS_QF_ENTRY : BUF_HAS_LL_ENTRY; ! if (!(curbuf->b_has_qf_entry & buf_has_flag)) return; if (wp != NULL) { *************** *** 2758,2764 **** } if (!found_one) ! curbuf->b_has_qf_entry = FALSE; } /* --- 2761,2767 ---- } if (!found_one) ! curbuf->b_has_qf_entry &= ~buf_has_flag; } /* *** ../vim-7.4.2080/src/structs.h 2016-07-17 18:28:59.023697505 +0200 --- src/structs.h 2016-07-20 21:22:09.980103410 +0200 *************** *** 1906,1911 **** --- 1906,1913 ---- #ifdef FEAT_QUICKFIX char_u *b_p_bh; /* 'bufhidden' */ char_u *b_p_bt; /* 'buftype' */ + #define BUF_HAS_QF_ENTRY 1 + #define BUF_HAS_LL_ENTRY 2 int b_has_qf_entry; #endif int b_p_bl; /* 'buflisted' */ *** ../vim-7.4.2080/src/testdir/test_quickfix.vim 2016-07-17 19:25:00.964690765 +0200 --- src/testdir/test_quickfix.vim 2016-07-20 21:20:05.421397180 +0200 *************** *** 1341,1353 **** enew | only ! call s:create_test_file('Xqftestfile') ! edit Xqftestfile ! ! Xgetexpr ['Xqftestfile:5:Line5', ! \ 'Xqftestfile:10:Line10', ! \ 'Xqftestfile:15:Line15', ! \ 'Xqftestfile:20:Line20'] 6,14delete call append(6, ['Buffer', 'Window']) --- 1341,1354 ---- enew | only ! let fname = 'Xqftestfile' . a:cchar ! call s:create_test_file(fname) ! exe 'edit ' . fname ! ! Xgetexpr [fname . ':5:Line5', ! \ fname . ':10:Line10', ! \ fname . ':15:Line15', ! \ fname . ':20:Line20'] 6,14delete call append(6, ['Buffer', 'Window']) *************** *** 1359,1369 **** call assert_equal(13, l[3].lnum) enew! ! call delete('Xqftestfile') endfunction function! Test_adjust_lnum() call Xadjust_qflnum('c') call Xadjust_qflnum('l') endfunction --- 1360,1372 ---- call assert_equal(13, l[3].lnum) enew! ! call delete(fname) endfunction function! Test_adjust_lnum() + call setloclist(0, []) call Xadjust_qflnum('c') + call setqflist([]) call Xadjust_qflnum('l') endfunction *** ../vim-7.4.2080/src/version.c 2016-07-20 00:10:44.488249992 +0200 --- src/version.c 2016-07-20 21:21:50.128309557 +0200 *************** *** 760,761 **** --- 760,763 ---- { /* Add new patch number below this line */ + /**/ + 2081, /**/ -- Q: How many hardware engineers does it take to change a lightbulb? A: None. We'll fix it in software. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///