diff src/buffer.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 a836d122231a
children 10e0d7d96cb0
line wrap: on
line diff
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -60,7 +60,9 @@ static char *e_auabort = N_("E855: Autoc
 /* Number of times free_buffer() was called. */
 static int	buf_free_count = 0;
 
-/* Read data from buffer for retrying. */
+/*
+ * Read data from buffer for retrying.
+ */
     static int
 read_buffer(
     int		read_stdin,	    /* read file from stdin, otherwise fifo */
@@ -104,7 +106,7 @@ read_buffer(
 	if (!readonlymode && !BUFEMPTY())
 	    changed();
 	else if (retval == OK)
-	    unchanged(curbuf, FALSE);
+	    unchanged(curbuf, FALSE, TRUE);
 
 	if (retval == OK)
 	{
@@ -275,7 +277,7 @@ open_buffer(
        )
 	changed();
     else if (retval == OK && !read_stdin && !read_fifo)
-	unchanged(curbuf, FALSE);
+	unchanged(curbuf, FALSE, TRUE);
     save_file_ff(curbuf);		/* keep this fileformat */
 
     /* Set last_changedtick to avoid triggering a TextChanged autocommand right
@@ -700,7 +702,7 @@ aucmd_abort:
 buf_clear_file(buf_T *buf)
 {
     buf->b_ml.ml_line_count = 1;
-    unchanged(buf, TRUE);
+    unchanged(buf, TRUE, TRUE);
     buf->b_shortname = FALSE;
     buf->b_p_eol = TRUE;
     buf->b_start_eol = TRUE;