aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/option.c
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2021-07-09 18:52:26 +0200
committerGitHub <noreply@github.com>2021-07-09 18:52:26 +0200
commit37af69285aa10b423ddaac5176328b4728012e0a (patch)
tree7d9edabdf4356b01e4a0798e5b9e6431f264db74 /src/nvim/option.c
parent191d3e6af7a248c86f0adde22b7768095f9c0356 (diff)
parentff53c5585f46bed9622bd4a3071c8cf3db96a9ac (diff)
downloadrneovim-37af69285aa10b423ddaac5176328b4728012e0a.tar.gz
rneovim-37af69285aa10b423ddaac5176328b4728012e0a.tar.bz2
rneovim-37af69285aa10b423ddaac5176328b4728012e0a.zip
Merge pull request #15036 from vigoux/decurbuf-2
refactor(undo): don't assume curbuf in u_compute_hash
Diffstat (limited to 'src/nvim/option.c')
-rw-r--r--src/nvim/option.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/nvim/option.c b/src/nvim/option.c
index 861a8f5d4b..0a8a60701a 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -3837,22 +3837,19 @@ static char *set_bool_option(const int opt_idx, char_u *const varp,
// any changes in between.
if (curbuf->b_p_udf || p_udf) {
char_u hash[UNDO_HASH_SIZE];
- buf_T *save_curbuf = curbuf;
FOR_ALL_BUFFERS(bp) {
- curbuf = bp;
// When 'undofile' is set globally: for every buffer, otherwise
// 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
+ if ((curbuf == bp
|| (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);
+ && !bufIsChanged(bp) && bp->b_ml.ml_mfp != NULL) {
+ u_compute_hash(bp, hash);
+ u_read_undo(NULL, hash, bp->b_fname);
}
}
- curbuf = save_curbuf;
}
} else if ((int *)varp == &curbuf->b_p_ro) {
// when 'readonly' is reset globally, also reset readonlymode