vim-patch:7.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.

2f095a4bc4
This commit is contained in:
James McCoy
2016-12-12 15:05:20 -05:00
parent a86d8b4088
commit ab43303df7
3 changed files with 50 additions and 33 deletions

View File

@@ -609,6 +609,7 @@ struct file_buffer {
int b_p_bomb; ///< 'bomb'
char_u *b_p_bh; ///< 'bufhidden'
char_u *b_p_bt; ///< 'buftype'
bool b_has_qf_entry; ///< quickfix exists for buffer
int b_p_bl; ///< 'buflisted'
int b_p_cin; ///< 'cindent'
char_u *b_p_cino; ///< 'cinoptions'
@@ -1037,7 +1038,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 */
int w_filler_rows; /* number of filler rows at the end of the
window */

View File

@@ -1015,9 +1015,14 @@ static int qf_add_entry(qf_info_T *qi, char_u *dir, char_u *fname, int bufnum,
qfline_T *qfp = xmalloc(sizeof(qfline_T));
qfline_T **lastp; // pointer to qf_last or NULL
if (bufnum != 0)
if (bufnum != 0) {
buf_T *buf = buflist_findnr(bufnum);
qfp->qf_fnum = bufnum;
else
if (buf != NULL) {
buf->b_has_qf_entry = true;
}
} else
qfp->qf_fnum = qf_get_fnum(dir, fname);
qfp->qf_text = vim_strsave(mesg);
qfp->qf_lnum = lnum;
@@ -1190,16 +1195,14 @@ void copy_loclist(win_T *from, win_T *to)
to->w_llist->qf_curlist = qi->qf_curlist; /* current list */
}
/*
* 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 BACKSLASH_IN_FILENAME
if (directory != NULL)
@@ -1223,12 +1226,16 @@ static int qf_get_fnum(char_u *directory, char_u *fname)
ptr = vim_strsave(fname);
}
/* Use concatenated directory name and file name */
fnum = buflist_add(ptr, 0);
buf = buflist_new(ptr, NULL, (linenr_T)0, 0);
xfree(ptr);
return fnum;
} else {
buf = buflist_new(fname, NULL, (linenr_T)0, 0);
}
return buflist_add(fname, 0);
if (buf == NULL) {
return 0;
}
buf->b_has_qf_entry = true;
return buf->b_fnum;
}
/*
@@ -2104,7 +2111,11 @@ void qf_mark_adjust(win_T *wp, linenr_T line1, linenr_T line2, long amount, long
qfline_T *qfp;
int idx;
qf_info_T *qi = &ql_info;
bool found_one = false;
if (!curbuf->b_has_qf_entry) {
return;
}
if (wp != NULL) {
if (wp->w_llist == NULL)
return;
@@ -2117,6 +2128,7 @@ void qf_mark_adjust(win_T *wp, linenr_T line1, linenr_T line2, long amount, long
i < qi->qf_lists[idx].qf_count && qfp != NULL;
++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)
qfp->qf_cleared = TRUE;
@@ -2125,6 +2137,10 @@ void qf_mark_adjust(win_T *wp, linenr_T line1, linenr_T line2, long amount, long
} else if (amount_after && qfp->qf_lnum > line2)
qfp->qf_lnum += amount_after;
}
if (!found_one) {
curbuf->b_has_qf_entry = false;
}
}
/*

View File

@@ -556,7 +556,7 @@ static int included_patches[] = {
// 1887 NA
// 1886 NA
// 1885 NA
// 1884,
1884,
// 1883 NA
1882,
1881,