comparison 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
comparison
equal deleted inserted replaced
16995:6664cc1a0af4 16996:d5e1e09a829f
840 } 840 }
841 841
842 /* 842 /*
843 * Called when the changed flag must be reset for buffer "buf". 843 * Called when the changed flag must be reset for buffer "buf".
844 * When "ff" is TRUE also reset 'fileformat'. 844 * When "ff" is TRUE also reset 'fileformat'.
845 * When "always_inc_changedtick" is TRUE b:changedtick is incremented also when
846 * the changed flag was off.
845 */ 847 */
846 void 848 void
847 unchanged(buf_T *buf, int ff) 849 unchanged(buf_T *buf, int ff, int always_inc_changedtick)
848 { 850 {
849 if (buf->b_changed || (ff && file_ff_differs(buf, FALSE))) 851 if (buf->b_changed || (ff && file_ff_differs(buf, FALSE)))
850 { 852 {
851 buf->b_changed = 0; 853 buf->b_changed = 0;
852 ml_setflags(buf); 854 ml_setflags(buf);
855 check_status(buf); 857 check_status(buf);
856 redraw_tabline = TRUE; 858 redraw_tabline = TRUE;
857 #ifdef FEAT_TITLE 859 #ifdef FEAT_TITLE
858 need_maketitle = TRUE; // set window title later 860 need_maketitle = TRUE; // set window title later
859 #endif 861 #endif
860 } 862 ++CHANGEDTICK(buf);
861 ++CHANGEDTICK(buf); 863 }
864 else if (always_inc_changedtick)
865 ++CHANGEDTICK(buf);
862 #ifdef FEAT_NETBEANS_INTG 866 #ifdef FEAT_NETBEANS_INTG
863 netbeans_unmodified(buf); 867 netbeans_unmodified(buf);
864 #endif 868 #endif
865 } 869 }
866 870