diff options
author | KunMing Xie <qqzz014@gmail.com> | 2017-09-11 22:17:41 +0800 |
---|---|---|
committer | James McCoy <jamessan@jamessan.com> | 2017-09-11 10:17:41 -0400 |
commit | d2cbc311855114b7736919a344a82e303d4a8164 (patch) | |
tree | 295e5fa24b4af78d262ed5e7c01daf9f0129f493 /src/nvim/diff.c | |
parent | f51a397010dcf4a8308c3b0249810696375b82b2 (diff) | |
download | rneovim-d2cbc311855114b7736919a344a82e303d4a8164.tar.gz rneovim-d2cbc311855114b7736919a344a82e303d4a8164.tar.bz2 rneovim-d2cbc311855114b7736919a344a82e303d4a8164.zip |
Vim-patch 8.0.0300 (#7258)
vim-patch:8.0.0300
Problem: Cannot stop diffing hidden buffers. (Daniel Hahler)
Solution: When using :diffoff! make the whole list if diffed buffers empty.
(closes vim/vim#736)
https://github.com/vim/vim/commit/25ea0544587dd45088512fec9d7a685e35fea679
Diffstat (limited to 'src/nvim/diff.c')
-rw-r--r-- | src/nvim/diff.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/nvim/diff.c b/src/nvim/diff.c index 17de4284ce..cc0f3b2629 100644 --- a/src/nvim/diff.c +++ b/src/nvim/diff.c @@ -135,6 +135,20 @@ void diff_buf_add(buf_T *buf) EMSGN(_("E96: Cannot diff more than %" PRId64 " buffers"), DB_COUNT); } +/// +/// Remove all buffers to make diffs for. +/// +static void diff_buf_clear(void) +{ + for (int i = 0; i < DB_COUNT; i++) { + if (curtab->tp_diffbuf[i] != NULL) { + curtab->tp_diffbuf[i] = NULL; + curtab->tp_diff_invalid = true; + diff_redraw(true); + } + } +} + /// Find buffer "buf" in the list of diff buffers for the current tab page. /// /// @param buf The buffer to find. @@ -1175,6 +1189,11 @@ void ex_diffoff(exarg_T *eap) diffwin |= wp->w_p_diff; } + // Also remove hidden buffers from the list. + if (eap->forceit) { + diff_buf_clear(); + } + // Remove "hor" from from 'scrollopt' if there are no diff windows left. if (!diffwin && (vim_strchr(p_sbo, 'h') != NULL)) { do_cmdline_cmd("set sbo-=hor"); |