comparison src/fileio.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 ce04ebdf26b8
children 10e0d7d96cb0
comparison
equal deleted inserted replaced
16995:6664cc1a0af4 16996:d5e1e09a829f
4906 * writing to the original file and '+' is not in 'cpoptions'. */ 4906 * writing to the original file and '+' is not in 'cpoptions'. */
4907 if (reset_changed && whole && !append 4907 if (reset_changed && whole && !append
4908 && !write_info.bw_conv_error 4908 && !write_info.bw_conv_error
4909 && (overwriting || vim_strchr(p_cpo, CPO_PLUS) != NULL)) 4909 && (overwriting || vim_strchr(p_cpo, CPO_PLUS) != NULL))
4910 { 4910 {
4911 unchanged(buf, TRUE); 4911 unchanged(buf, TRUE, FALSE);
4912 /* b:changedtick is always incremented in unchanged() but that 4912 /* b:changedtick is may be incremented in unchanged() but that
4913 * should not trigger a TextChanged event. */ 4913 * should not trigger a TextChanged event. */
4914 if (buf->b_last_changedtick + 1 == CHANGEDTICK(buf)) 4914 if (buf->b_last_changedtick + 1 == CHANGEDTICK(buf))
4915 buf->b_last_changedtick = CHANGEDTICK(buf); 4915 buf->b_last_changedtick = CHANGEDTICK(buf);
4916 u_unchanged(buf); 4916 u_unchanged(buf);
4917 u_update_save_nr(buf); 4917 u_update_save_nr(buf);
7079 } 7079 }
7080 } 7080 }
7081 else if (buf == curbuf) /* "buf" still valid */ 7081 else if (buf == curbuf) /* "buf" still valid */
7082 { 7082 {
7083 /* Mark the buffer as unmodified and free undo info. */ 7083 /* Mark the buffer as unmodified and free undo info. */
7084 unchanged(buf, TRUE); 7084 unchanged(buf, TRUE, TRUE);
7085 if ((flags & READ_KEEP_UNDO) == 0) 7085 if ((flags & READ_KEEP_UNDO) == 0)
7086 { 7086 {
7087 u_blockfree(buf); 7087 u_blockfree(buf);
7088 u_clearall(buf); 7088 u_clearall(buf);
7089 } 7089 }