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.
c024b46678
This commit is contained in:
Justin M. Keyes
2019-08-31 14:06:45 +02:00
parent d7aea13fee
commit 83c5701fe6
7 changed files with 26 additions and 22 deletions

View File

@@ -478,9 +478,11 @@ changed_lines(
}
}
/// Called when the changed flag must be reset for buffer "buf".
/// When "ff" is true also reset 'fileformat'.
void unchanged(buf_T *buf, int ff)
/// 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 even
/// when the changed flag was off.
void unchanged(buf_T *buf, int ff, bool always_inc_changedtick)
{
if (buf->b_changed || (ff && file_ff_differs(buf, false))) {
buf->b_changed = false;
@@ -491,8 +493,10 @@ void unchanged(buf_T *buf, int ff)
check_status(buf);
redraw_tabline = true;
need_maketitle = true; // set window title later
buf_inc_changedtick(buf);
} else if (always_inc_changedtick) {
buf_inc_changedtick(buf);
}
buf_inc_changedtick(buf);
}
/// Insert string "p" at the cursor position. Stops at a NUL byte.