Mercurial > vim
comparison src/option.c @ 3246:c4898d6d73a2 v7.3.392
updated for version 7.3.392
Problem: When setting 'undofile' while the file is already loaded but
unchanged, try reading the undo file. (Andy Wokula)
Solution: Compute a checksum of the text when 'undofile' is set. (Christian
Brabandt)
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Wed, 04 Jan 2012 19:34:37 +0100 |
parents | d2f70593afeb |
children | 320cc46d0eb0 |
comparison
equal
deleted
inserted
replaced
3245:2116ffde38ac | 3246:c4898d6d73a2 |
---|---|
7514 if ((int *)varp == &p_cp) | 7514 if ((int *)varp == &p_cp) |
7515 { | 7515 { |
7516 compatible_set(); | 7516 compatible_set(); |
7517 } | 7517 } |
7518 | 7518 |
7519 #ifdef FEAT_PERSISTENT_UNDO | |
7520 /* 'undofile' */ | |
7521 else if ((int *)varp == &curbuf->b_p_udf || (int *)varp == &p_udf) | |
7522 { | |
7523 char_u hash[UNDO_HASH_SIZE]; | |
7524 buf_T *save_curbuf = curbuf; | |
7525 | |
7526 for (curbuf = firstbuf; curbuf != NULL; curbuf = curbuf->b_next) | |
7527 { | |
7528 /* When 'undofile' is set globally: for every buffer, otherwise | |
7529 * only for the current buffer: Try to read in the undofile, if | |
7530 * one exists and the buffer wasn't changed. */ | |
7531 if ((curbuf == save_curbuf | |
7532 || (opt_flags & OPT_GLOBAL) || opt_flags == 0) | |
7533 && !curbufIsChanged()) | |
7534 { | |
7535 u_compute_hash(hash); | |
7536 u_read_undo(NULL, hash, curbuf->b_fname); | |
7537 } | |
7538 } | |
7539 curbuf = save_curbuf; | |
7540 } | |
7541 #endif | |
7542 | |
7519 /* 'list', 'number' */ | 7543 /* 'list', 'number' */ |
7520 else if ((int *)varp == &curwin->w_p_list | 7544 else if ((int *)varp == &curwin->w_p_list |
7521 || (int *)varp == &curwin->w_p_nu | 7545 || (int *)varp == &curwin->w_p_nu |
7522 || (int *)varp == &curwin->w_p_rnu) | 7546 || (int *)varp == &curwin->w_p_rnu) |
7523 { | 7547 { |