diff src/change.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 5493e31010e1
children b2616a8be8a6
line wrap: on
line diff
--- a/src/change.c
+++ b/src/change.c
@@ -842,9 +842,11 @@ changed_lines(
 /*
  * Called when the changed flag must be reset for buffer "buf".
  * When "ff" is TRUE also reset 'fileformat'.
+ * When "always_inc_changedtick" is TRUE b:changedtick is incremented also when
+ * the changed flag was off.
  */
     void
-unchanged(buf_T *buf, int ff)
+unchanged(buf_T *buf, int ff, int always_inc_changedtick)
 {
     if (buf->b_changed || (ff && file_ff_differs(buf, FALSE)))
     {
@@ -857,8 +859,10 @@ unchanged(buf_T *buf, int ff)
 #ifdef FEAT_TITLE
 	need_maketitle = TRUE;	    // set window title later
 #endif
+	++CHANGEDTICK(buf);
     }
-    ++CHANGEDTICK(buf);
+    else if (always_inc_changedtick)
+	++CHANGEDTICK(buf);
 #ifdef FEAT_NETBEANS_INTG
     netbeans_unmodified(buf);
 #endif