To: vim_dev@googlegroups.com Subject: Patch 8.2.1775 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.1775 Problem: MS-Windows: adding a long quickfix list is slow. Solution: Shorten the buffer name only for the first entry. (Yegappan Lakshmanan, closes #7039, closes #7033) Files: src/quickfix.c, src/testdir/test_quickfix.vim *** ../vim-8.2.1774/src/quickfix.c 2020-09-13 22:21:18.839009322 +0200 --- src/quickfix.c 2020-09-29 22:45:47.291934952 +0200 *************** *** 4496,4501 **** --- 4496,4502 ---- linenr_T lnum, qfline_T *qfp, char_u *dirname, + int first_bufline, char_u *qftf_str) { int len; *************** *** 4520,4528 **** vim_strncpy(IObuff, gettail(errbuf->b_fname), IOSIZE - 1); else { ! // shorten the file name if not done already ! if (errbuf->b_sfname == NULL ! || mch_isFullName(errbuf->b_sfname)) { if (*dirname == NUL) mch_dirname(dirname, MAXPATHL); --- 4521,4531 ---- vim_strncpy(IObuff, gettail(errbuf->b_fname), IOSIZE - 1); else { ! // Shorten the file name if not done already. ! // For optimization, do this only for the first entry in a ! // buffer. ! if (first_bufline && (errbuf->b_sfname == NULL ! || mch_isFullName(errbuf->b_sfname))) { if (*dirname == NUL) mch_dirname(dirname, MAXPATHL); *************** *** 4663,4668 **** --- 4666,4672 ---- { char_u dirname[MAXPATHL]; int invalid_val = FALSE; + int prev_bufnr = -1; *dirname = NUL; *************** *** 4697,4705 **** invalid_val = TRUE; } ! if (qf_buf_add_line(buf, lnum, qfp, dirname, qftf_str) == FAIL) break; ++lnum; qfp = qfp->qf_next; if (qfp == NULL) --- 4701,4711 ---- invalid_val = TRUE; } ! if (qf_buf_add_line(buf, lnum, qfp, dirname, ! prev_bufnr != qfp->qf_fnum, qftf_str) == FAIL) break; + prev_bufnr = qfp->qf_fnum; ++lnum; qfp = qfp->qf_next; if (qfp == NULL) *** ../vim-8.2.1774/src/testdir/test_quickfix.vim 2020-09-13 22:21:18.843009309 +0200 --- src/testdir/test_quickfix.vim 2020-09-29 22:44:54.648081521 +0200 *************** *** 3996,4001 **** --- 3996,4013 ---- " Displaying the quickfix list should simplify the file path silent! clist call assert_equal('test_quickfix.vim', bufname('test_quickfix.vim')) + " Add a few entries for the same file with different paths and check whether + " the buffer name is shortened + %bwipe + call setqflist([], 'f') + call setqflist([{'filename' : 'test_quickfix.vim', 'lnum' : 10}, + \ {'filename' : '../testdir/test_quickfix.vim', 'lnum' : 20}, + \ {'filename' : fname, 'lnum' : 30}], ' ') + copen + call assert_equal(['test_quickfix.vim|10| ', + \ 'test_quickfix.vim|20| ', + \ 'test_quickfix.vim|30| '], getline(1, '$')) + cclose endfunc " Quickfix title tests *** ../vim-8.2.1774/src/version.c 2020-09-29 22:16:05.893669051 +0200 --- src/version.c 2020-09-29 22:46:52.191750890 +0200 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 1775, /**/ -- hundred-and-one symptoms of being an internet addict: 23. You can't call your mother... she doesn't have VOIP /// 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 ///