aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/fileio.c
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2019-08-31 14:06:45 +0200
committerJustin M. Keyes <justinkz@gmail.com>2019-09-04 21:21:28 +0200
commit83c5701fe6d182c2f458b95d09114d9c861f8893 (patch)
tree76b83432a84a3f603bb35bd0452c73d12d4d6020 /src/nvim/fileio.c
parentd7aea13fee879a5e7854f2ebe9b7321cd8daf84f (diff)
downloadrneovim-83c5701fe6d182c2f458b95d09114d9c861f8893.tar.gz
rneovim-83c5701fe6d182c2f458b95d09114d9c861f8893.tar.bz2
rneovim-83c5701fe6d182c2f458b95d09114d9c861f8893.zip
vim-patch:8.1.1498: ":write" increments b:changedtick even though nothing changed
Problem: ":write" increments b:changedtick even though nothing changed. (Daniel Hahler) Solution: Only increment b:changedtick if the modified flag is reset. https://github.com/vim/vim/commit/c024b4667875e5bc6fd0ed791530e33c3161bff7
Diffstat (limited to 'src/nvim/fileio.c')
-rw-r--r--src/nvim/fileio.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c
index 8b19257d3d..b99a254fad 100644
--- a/src/nvim/fileio.c
+++ b/src/nvim/fileio.c
@@ -3485,10 +3485,10 @@ restore_backup:
if (reset_changed && whole && !append
&& !write_info.bw_conv_error
&& (overwriting || vim_strchr(p_cpo, CPO_PLUS) != NULL)) {
- unchanged(buf, true);
+ unchanged(buf, true, false);
const varnumber_T changedtick = buf_get_changedtick(buf);
if (buf->b_last_changedtick + 1 == changedtick) {
- // changedtick is always incremented in unchanged() but that
+ // b:changedtick may be incremented in unchanged() but that
// should not trigger a TextChanged event.
buf->b_last_changedtick = changedtick;
}
@@ -5107,14 +5107,14 @@ void buf_reload(buf_T *buf, int orig_mode)
}
(void)move_lines(savebuf, buf);
}
- } else if (buf == curbuf) { /* "buf" still valid */
- /* Mark the buffer as unmodified and free undo info. */
- unchanged(buf, TRUE);
+ } else if (buf == curbuf) { // "buf" still valid.
+ // Mark the buffer as unmodified and free undo info.
+ unchanged(buf, true, true);
if ((flags & READ_KEEP_UNDO) == 0) {
u_blockfree(buf);
u_clearall(buf);
} else {
- /* Mark all undo states as changed. */
+ // Mark all undo states as changed.
u_unchanged(curbuf);
}
}