summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-06-03 19:05:49 +0200
committerBram Moolenaar <Bram@vim.org>2016-06-03 19:05:49 +0200
commit2f095a4bc4d786e0ac834f48dd18a94fe2d140e3 (patch)
tree8334739af2be9fd8e3bd3b010c05ae1098bc3231
parentea0345901cc2af29f9c5dd0d9d8a818d5f96a63b (diff)
patch 7.4.1884v7.4.1884
Problem: Updating marks in a quickfix list is very slow when the list is long. Solution: Only update marks if the buffer has a quickfix entry.
-rw-r--r--src/quickfix.c75
-rw-r--r--src/structs.h5
-rw-r--r--src/version.c2
3 files changed, 51 insertions, 31 deletions
diff --git a/src/quickfix.c b/src/quickfix.c
index 23b1705b33..b72f7d1f68 100644
--- a/src/quickfix.c
+++ b/src/quickfix.c
@@ -1178,7 +1178,13 @@ qf_add_entry(
if ((qfp = (qfline_T *)alloc((unsigned)sizeof(qfline_T))) == NULL)
return FAIL;
if (bufnum != 0)
+ {
+ buf_T *buf = buflist_findnr(bufnum);
+
qfp->qf_fnum = bufnum;
+ if (buf != NULL)
+ buf->b_has_qf_entry = TRUE;
+ }
else
qfp->qf_fnum = qf_get_fnum(dir, fname);
if ((qfp->qf_text = vim_strsave(mesg)) == NULL)
@@ -1378,50 +1384,54 @@ copy_loclist(win_T *from, win_T *to)
}
/*
- * get buffer number for file "dir.name"
+ * Get buffer number for file "dir.name".
+ * Also sets the b_has_qf_entry flag.
*/
static int
qf_get_fnum(char_u *directory, char_u *fname)
{
+ char_u *ptr;
+ buf_T *buf;
+
if (fname == NULL || *fname == NUL) /* no file name */
return 0;
- {
- char_u *ptr;
- int fnum;
#ifdef VMS
- vms_remove_version(fname);
+ vms_remove_version(fname);
#endif
#ifdef BACKSLASH_IN_FILENAME
- if (directory != NULL)
- slash_adjust(directory);
- slash_adjust(fname);
+ if (directory != NULL)
+ slash_adjust(directory);
+ slash_adjust(fname);
#endif
- if (directory != NULL && !vim_isAbsName(fname)
- && (ptr = concat_fnames(directory, fname, TRUE)) != NULL)
+ if (directory != NULL && !vim_isAbsName(fname)
+ && (ptr = concat_fnames(directory, fname, TRUE)) != NULL)
+ {
+ /*
+ * Here we check if the file really exists.
+ * This should normally be true, but if make works without
+ * "leaving directory"-messages we might have missed a
+ * directory change.
+ */
+ if (mch_getperm(ptr) < 0)
{
- /*
- * Here we check if the file really exists.
- * This should normally be true, but if make works without
- * "leaving directory"-messages we might have missed a
- * directory change.
- */
- if (mch_getperm(ptr) < 0)
- {
- vim_free(ptr);
- directory = qf_guess_filepath(fname);
- if (directory)
- ptr = concat_fnames(directory, fname, TRUE);
- else
- ptr = vim_strsave(fname);
- }
- /* Use concatenated directory name and file name */
- fnum = buflist_add(ptr, 0);
vim_free(ptr);
- return fnum;
+ directory = qf_guess_filepath(fname);
+ if (directory)
+ ptr = concat_fnames(directory, fname, TRUE);
+ else
+ ptr = vim_strsave(fname);
}
- return buflist_add(fname, 0);
+ /* Use concatenated directory name and file name */
+ buf = buflist_new(ptr, NULL, (linenr_T)0, 0);
+ vim_free(ptr);
}
+ else
+ buf = buflist_new(fname, NULL, (linenr_T)0, 0);
+ if (buf == NULL)
+ return 0;
+ buf->b_has_qf_entry = TRUE;
+ return buf->b_fnum;
}
/*
@@ -2414,7 +2424,10 @@ qf_mark_adjust(
qfline_T *qfp;
int idx;
qf_info_T *qi = &ql_info;
+ int found_one = FALSE;
+ if (!curbuf->b_has_qf_entry)
+ return;
if (wp != NULL)
{
if (wp->w_llist == NULL)
@@ -2429,6 +2442,7 @@ qf_mark_adjust(
++i, qfp = qfp->qf_next)
if (qfp->qf_fnum == curbuf->b_fnum)
{
+ found_one = TRUE;
if (qfp->qf_lnum >= line1 && qfp->qf_lnum <= line2)
{
if (amount == MAXLNUM)
@@ -2439,6 +2453,9 @@ qf_mark_adjust(
else if (amount_after && qfp->qf_lnum > line2)
qfp->qf_lnum += amount_after;
}
+
+ if (!found_one)
+ curbuf->b_has_qf_entry = FALSE;
}
/*
diff --git a/src/structs.h b/src/structs.h
index 08d3325431..d9498e4d93 100644
--- a/src/structs.h
+++ b/src/structs.h
@@ -1865,9 +1865,10 @@ struct file_buffer
#ifdef FEAT_MBYTE
int b_p_bomb; /* 'bomb' */
#endif
-#if defined(FEAT_QUICKFIX)
+#ifdef FEAT_QUICKFIX
char_u *b_p_bh; /* 'bufhidden' */
char_u *b_p_bt; /* 'buftype' */
+ int b_has_qf_entry;
#endif
int b_p_bl; /* 'buflisted' */
#ifdef FEAT_CINDENT
@@ -2465,7 +2466,7 @@ struct window_S
int w_wrow, w_wcol; /* cursor position in window */
linenr_T w_botline; /* number of the line below the bottom of
- the screen */
+ the window */
int w_empty_rows; /* number of ~ rows in window */
#ifdef FEAT_DIFF
int w_filler_rows; /* number of filler rows at the end of the
diff --git a/src/version.c b/src/version.c
index 6278002e90..0f9e840caf 100644
--- a/src/version.c
+++ b/src/version.c
@@ -754,6 +754,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1884,
+/**/
1883,
/**/
1882,