diff --git a/7.4.768 b/7.4.768 new file mode 100644 index 0000000..d0046fb --- /dev/null +++ b/7.4.768 @@ -0,0 +1,234 @@ +To: vim_dev@googlegroups.com +Subject: Patch 7.4.768 +Fcc: outbox +From: Bram Moolenaar +Mime-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit +------------ + +Patch 7.4.768 +Problem: :diffoff only works properly once. +Solution: Also make :diffoff work when used a second time. (Olaf Dabrunz) +Files: src/diff.c + + +*** ../vim-7.4.767/src/diff.c 2015-03-31 13:33:00.781525085 +0200 +--- src/diff.c 2015-07-03 14:55:54.953220651 +0200 +*************** +*** 1138,1169 **** + curwin = old_curwin; + # endif + +- wp->w_p_diff = TRUE; +- + /* Use 'scrollbind' and 'cursorbind' when available */ + #ifdef FEAT_SCROLLBIND +! if (!wp->w_p_diff_saved) + wp->w_p_scb_save = wp->w_p_scb; + wp->w_p_scb = TRUE; + #endif + #ifdef FEAT_CURSORBIND +! if (!wp->w_p_diff_saved) + wp->w_p_crb_save = wp->w_p_crb; + wp->w_p_crb = TRUE; + #endif +! if (!wp->w_p_diff_saved) + wp->w_p_wrap_save = wp->w_p_wrap; + wp->w_p_wrap = FALSE; + # ifdef FEAT_FOLDING + curwin = wp; + curbuf = curwin->w_buffer; +! if (!wp->w_p_diff_saved) + wp->w_p_fdm_save = vim_strsave(wp->w_p_fdm); + set_string_option_direct((char_u *)"fdm", -1, (char_u *)"diff", + OPT_LOCAL|OPT_FREE, 0); + curwin = old_curwin; + curbuf = curwin->w_buffer; +! if (!wp->w_p_diff_saved) + { + wp->w_p_fdc_save = wp->w_p_fdc; + wp->w_p_fen_save = wp->w_p_fen; +--- 1138,1171 ---- + curwin = old_curwin; + # endif + + /* Use 'scrollbind' and 'cursorbind' when available */ + #ifdef FEAT_SCROLLBIND +! if (!wp->w_p_diff) + wp->w_p_scb_save = wp->w_p_scb; + wp->w_p_scb = TRUE; + #endif + #ifdef FEAT_CURSORBIND +! if (!wp->w_p_diff) + wp->w_p_crb_save = wp->w_p_crb; + wp->w_p_crb = TRUE; + #endif +! if (!wp->w_p_diff) + wp->w_p_wrap_save = wp->w_p_wrap; + wp->w_p_wrap = FALSE; + # ifdef FEAT_FOLDING + curwin = wp; + curbuf = curwin->w_buffer; +! if (!wp->w_p_diff) +! { +! if (wp->w_p_diff_saved) +! free_string_option(wp->w_p_fdm_save); + wp->w_p_fdm_save = vim_strsave(wp->w_p_fdm); ++ } + set_string_option_direct((char_u *)"fdm", -1, (char_u *)"diff", + OPT_LOCAL|OPT_FREE, 0); + curwin = old_curwin; + curbuf = curwin->w_buffer; +! if (!wp->w_p_diff) + { + wp->w_p_fdc_save = wp->w_p_fdc; + wp->w_p_fen_save = wp->w_p_fen; +*************** +*** 1183,1188 **** +--- 1185,1192 ---- + /* Saved the current values, to be restored in ex_diffoff(). */ + wp->w_p_diff_saved = TRUE; + ++ wp->w_p_diff = TRUE; ++ + if (addbuf) + diff_buf_add(wp->w_buffer); + redraw_win_later(wp, NOT_VALID); +*************** +*** 1197,1203 **** + exarg_T *eap; + { + win_T *wp; +- win_T *old_curwin = curwin; + #ifdef FEAT_SCROLLBIND + int diffwin = FALSE; + #endif +--- 1201,1206 ---- +*************** +*** 1206,1262 **** + { + if (eap->forceit ? wp->w_p_diff : wp == curwin) + { +! /* Set 'diff', 'scrollbind' off and 'wrap' on. If option values +! * were saved in diff_win_options() restore them. */ + wp->w_p_diff = FALSE; + + #ifdef FEAT_SCROLLBIND +! if (wp->w_p_scb) +! wp->w_p_scb = wp->w_p_diff_saved ? wp->w_p_scb_save : FALSE; + #endif + #ifdef FEAT_CURSORBIND +! if (wp->w_p_crb) +! wp->w_p_crb = wp->w_p_diff_saved ? wp->w_p_crb_save : FALSE; + #endif +! if (!wp->w_p_wrap) +! wp->w_p_wrap = wp->w_p_diff_saved ? wp->w_p_wrap_save : TRUE; + #ifdef FEAT_FOLDING +- curwin = wp; +- curbuf = curwin->w_buffer; +- if (wp->w_p_diff_saved) +- { + free_string_option(wp->w_p_fdm); +! wp->w_p_fdm = wp->w_p_fdm_save; +! wp->w_p_fdm_save = empty_option; +! } +! else +! set_string_option_direct((char_u *)"fdm", -1, +! (char_u *)"manual", OPT_LOCAL|OPT_FREE, 0); +! curwin = old_curwin; +! curbuf = curwin->w_buffer; +! if (wp->w_p_fdc == diff_foldcolumn) +! wp->w_p_fdc = wp->w_p_diff_saved ? wp->w_p_fdc_save : 0; +! if (wp->w_p_fdl == 0 && wp->w_p_diff_saved) +! wp->w_p_fdl = wp->w_p_fdl_save; + +- if (wp->w_p_fen) +- { + /* Only restore 'foldenable' when 'foldmethod' is not + * "manual", otherwise we continue to show the diff folds. */ +! if (foldmethodIsManual(wp) || !wp->w_p_diff_saved) +! wp->w_p_fen = FALSE; +! else +! wp->w_p_fen = wp->w_p_fen_save; + } + +- foldUpdateAll(wp); +- /* make sure topline is not halfway a fold */ +- changed_window_setting_win(wp); +- #endif + /* Note: 'sbo' is not restored, it's a global option. */ + diff_buf_adjust(wp); +- +- wp->w_p_diff_saved = FALSE; + } + #ifdef FEAT_SCROLLBIND + diffwin |= wp->w_p_diff; +--- 1209,1255 ---- + { + if (eap->forceit ? wp->w_p_diff : wp == curwin) + { +! /* Set 'diff' off. If option values were saved in +! * diff_win_options(), restore the ones whose settings seem to have +! * been left over from diff mode. */ + wp->w_p_diff = FALSE; + ++ if (wp->w_p_diff_saved) ++ { ++ + #ifdef FEAT_SCROLLBIND +! if (wp->w_p_scb) +! wp->w_p_scb = wp->w_p_scb_save; + #endif + #ifdef FEAT_CURSORBIND +! if (wp->w_p_crb) +! wp->w_p_crb = wp->w_p_crb_save; + #endif +! if (!wp->w_p_wrap) +! wp->w_p_wrap = wp->w_p_wrap_save; + #ifdef FEAT_FOLDING + free_string_option(wp->w_p_fdm); +! wp->w_p_fdm = vim_strsave(wp->w_p_fdm_save); +! +! if (wp->w_p_fdc == diff_foldcolumn) +! wp->w_p_fdc = wp->w_p_fdc_save; +! if (wp->w_p_fdl == 0) +! wp->w_p_fdl = wp->w_p_fdl_save; + + /* Only restore 'foldenable' when 'foldmethod' is not + * "manual", otherwise we continue to show the diff folds. */ +! if (wp->w_p_fen) +! wp->w_p_fen = foldmethodIsManual(wp) ? FALSE +! : wp->w_p_fen_save; +! +! foldUpdateAll(wp); +! /* make sure topline is not halfway a fold */ +! changed_window_setting_win(wp); +! #endif + } + + /* Note: 'sbo' is not restored, it's a global option. */ + diff_buf_adjust(wp); + } + #ifdef FEAT_SCROLLBIND + diffwin |= wp->w_p_diff; +*** ../vim-7.4.767/src/version.c 2015-07-03 13:32:56.125020856 +0200 +--- src/version.c 2015-07-03 14:54:09.850320403 +0200 +*************** +*** 743,744 **** +--- 743,746 ---- + { /* Add new patch number below this line */ ++ /**/ ++ 768, + /**/ + +-- +If Apple would build a car... +... it would be powered by the sun, be reliable, five times +as fast and twice as easy to drive; but would only run on +five percent of the roads. + + /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ +/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ +\\\ an exciting new programming language -- http://www.Zimbu.org /// + \\\ help me help AIDS victims -- http://ICCF-Holland.org ///