0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

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.
This commit is contained in:
Bram Moolenaar
2019-06-08 18:07:21 +02:00
parent aef5c62a6f
commit c024b46678
9 changed files with 26 additions and 16 deletions

View File

@@ -60,7 +60,9 @@ static char *e_auabort = N_("E855: Autocommands caused command to abort");
/* 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;