forked from aniani/vim
updated for version 7.3.703
Problem: When 'undofile' is reset the hash is computed unnecessarily. Solution: Only compute the hash when the option was set. (Christian Brabandt)
This commit is contained in:
34
src/option.c
34
src/option.c
@@ -7573,24 +7573,30 @@ set_bool_option(opt_idx, varp, value, opt_flags)
|
|||||||
/* 'undofile' */
|
/* 'undofile' */
|
||||||
else if ((int *)varp == &curbuf->b_p_udf || (int *)varp == &p_udf)
|
else if ((int *)varp == &curbuf->b_p_udf || (int *)varp == &p_udf)
|
||||||
{
|
{
|
||||||
char_u hash[UNDO_HASH_SIZE];
|
/* Only take action when the option was set. When reset we do not
|
||||||
buf_T *save_curbuf = curbuf;
|
* delete the undo file, the option may be set again without making
|
||||||
|
* any changes in between. */
|
||||||
for (curbuf = firstbuf; curbuf != NULL; curbuf = curbuf->b_next)
|
if (curbuf->b_p_udf || p_udf)
|
||||||
{
|
{
|
||||||
/* When 'undofile' is set globally: for every buffer, otherwise
|
char_u hash[UNDO_HASH_SIZE];
|
||||||
* only for the current buffer: Try to read in the undofile, if
|
buf_T *save_curbuf = curbuf;
|
||||||
* one exists and the buffer wasn't changed and the buffer was
|
|
||||||
* loaded. */
|
for (curbuf = firstbuf; curbuf != NULL; curbuf = curbuf->b_next)
|
||||||
if ((curbuf == save_curbuf
|
|
||||||
|| (opt_flags & OPT_GLOBAL) || opt_flags == 0)
|
|
||||||
&& !curbufIsChanged() && curbuf->b_ml.ml_mfp != NULL)
|
|
||||||
{
|
{
|
||||||
u_compute_hash(hash);
|
/* When 'undofile' is set globally: for every buffer, otherwise
|
||||||
u_read_undo(NULL, hash, curbuf->b_fname);
|
* only for the current buffer: Try to read in the undofile,
|
||||||
|
* if one exists, the buffer wasn't changed and the buffer was
|
||||||
|
* loaded */
|
||||||
|
if ((curbuf == save_curbuf
|
||||||
|
|| (opt_flags & OPT_GLOBAL) || opt_flags == 0)
|
||||||
|
&& !curbufIsChanged() && curbuf->b_ml.ml_mfp != NULL)
|
||||||
|
{
|
||||||
|
u_compute_hash(hash);
|
||||||
|
u_read_undo(NULL, hash, curbuf->b_fname);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
curbuf = save_curbuf;
|
||||||
}
|
}
|
||||||
curbuf = save_curbuf;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -719,6 +719,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
703,
|
||||||
/**/
|
/**/
|
||||||
702,
|
702,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user