diff src/fileio.c @ 16996:d5e1e09a829f v8.1.1498

patch 8.1.1498: ":write" increments b:changedtick even though nothing changed commit https://github.com/vim/vim/commit/c024b4667875e5bc6fd0ed791530e33c3161bff7 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jun 8 18:07:21 2019 +0200 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.
author Bram Moolenaar <Bram@vim.org>
date Sat, 08 Jun 2019 18:15:05 +0200
parents ce04ebdf26b8
children 10e0d7d96cb0
line wrap: on
line diff
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -4908,8 +4908,8 @@ restore_backup:
 	    && !write_info.bw_conv_error
 	    && (overwriting || vim_strchr(p_cpo, CPO_PLUS) != NULL))
     {
-	unchanged(buf, TRUE);
-	/* b:changedtick is always incremented in unchanged() but that
+	unchanged(buf, TRUE, FALSE);
+	/* b:changedtick is may be incremented in unchanged() but that
 	 * should not trigger a TextChanged event. */
 	if (buf->b_last_changedtick + 1 == CHANGEDTICK(buf))
 	    buf->b_last_changedtick = CHANGEDTICK(buf);
@@ -7081,7 +7081,7 @@ buf_reload(buf_T *buf, int orig_mode)
 	    else if (buf == curbuf)  /* "buf" still valid */
 	    {
 		/* Mark the buffer as unmodified and free undo info. */
-		unchanged(buf, TRUE);
+		unchanged(buf, TRUE, TRUE);
 		if ((flags & READ_KEEP_UNDO) == 0)
 		{
 		    u_blockfree(buf);