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.
diff --git a/src/fileio.c b/src/fileio.c
index d746298..e6fb6bf 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -4908,8 +4908,8 @@
&& !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 @@
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);