diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-09-29 22:47:03 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-09-29 22:47:03 +0200 |
commit | 8ec92c977976d9e9225183e36a80e6b0cdbf1f51 (patch) | |
tree | fff0d1e92c0e148aee452e08f34fd4a6247598ba /src/quickfix.c | |
parent | 32fbc4f247a31e35ade0939542e11aa033a2554f (diff) | |
download | vim-git-8ec92c977976d9e9225183e36a80e6b0cdbf1f51.tar.gz |
patch 8.2.1775: MS-Windows: adding a long quickfix list is slowv8.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)
Diffstat (limited to 'src/quickfix.c')
-rw-r--r-- | src/quickfix.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/quickfix.c b/src/quickfix.c index 43d2d3fbd..d50cd16a1 100644 --- a/src/quickfix.c +++ b/src/quickfix.c @@ -4496,6 +4496,7 @@ qf_buf_add_line( linenr_T lnum, qfline_T *qfp, char_u *dirname, + int first_bufline, char_u *qftf_str) { int len; @@ -4520,9 +4521,11 @@ qf_buf_add_line( 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)) + // 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,6 +4666,7 @@ qf_fill_buffer(qf_list_T *qfl, buf_T *buf, qfline_T *old_last, int qf_winid) { char_u dirname[MAXPATHL]; int invalid_val = FALSE; + int prev_bufnr = -1; *dirname = NUL; @@ -4697,9 +4701,11 @@ qf_fill_buffer(qf_list_T *qfl, buf_T *buf, qfline_T *old_last, int qf_winid) invalid_val = TRUE; } - if (qf_buf_add_line(buf, lnum, qfp, dirname, qftf_str) == FAIL) + 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) |