diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2018-02-11 19:59:37 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-11 19:59:37 +0100 |
commit | f389196a344591da2f6cc2a63f4953e34316f954 (patch) | |
tree | 8cce092c29f33ae109dcf61e12e822d84aa014c7 /src/nvim/diff.c | |
parent | 2cfc1b055bba6bb0f7e263a69079c7f52303a78a (diff) | |
parent | f26a4d484b486019c90fc55af5e74e33de374bc4 (diff) | |
download | rneovim-f389196a344591da2f6cc2a63f4953e34316f954.tar.gz rneovim-f389196a344591da2f6cc2a63f4953e34316f954.tar.bz2 rneovim-f389196a344591da2f6cc2a63f4953e34316f954.zip |
Merge #7960 'vim patches'
Diffstat (limited to 'src/nvim/diff.c')
-rw-r--r-- | src/nvim/diff.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/nvim/diff.c b/src/nvim/diff.c index e55cf7bf7e..0ee1c3815d 100644 --- a/src/nvim/diff.c +++ b/src/nvim/diff.c @@ -1058,6 +1058,20 @@ void ex_diffthis(exarg_T *eap) diff_win_options(curwin, TRUE); } +static void set_diff_option(win_T *wp, int value) +{ + win_T *old_curwin = curwin; + + curwin = wp; + curbuf = curwin->w_buffer; + curbuf_lock++; + set_option_value("diff", (long)value, NULL, OPT_LOCAL); + curbuf_lock--; + curwin = old_curwin; + curbuf = curwin->w_buffer; +} + + /// Set options in window "wp" for diff mode. /// /// @param addbuf Add buffer to diff. @@ -1115,10 +1129,10 @@ void diff_win_options(win_T *wp, int addbuf) do_cmdline_cmd("set sbo+=hor"); } - // Saved the current values, to be restored in ex_diffoff(). - wp->w_p_diff_saved = TRUE; + // Save the current values, to be restored in ex_diffoff(). + wp->w_p_diff_saved = true; - wp->w_p_diff = true; + set_diff_option(wp, true); if (addbuf) { diff_buf_add(wp->w_buffer); @@ -1139,7 +1153,7 @@ void ex_diffoff(exarg_T *eap) // 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; + set_diff_option(wp, false); if (wp->w_p_diff_saved) { if (wp->w_p_scb) { |