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 #736)
Files: src/diff.c, src/testdir/test_diffmode.vim
*** ../vim-8.0.0299/src/diff.c 2016-10-18 14:50:14.731694041 +0200
--- src/diff.c 2017-02-03 22:53:01.787689761 +0100
***************
*** 139,144 ****
--- 139,161 ----
}
/*
+ * Remove all buffers to make diffs for.
+ */
+ static void
+ diff_buf_clear(void)
+ {
+ int i;
+
+ for (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.
* Return its index or DB_COUNT if not found.
*/
***************
*** 1257,1262 ****
--- 1274,1283 ----
#endif
}
+ /* Also remove hidden buffers from the list. */
+ if (eap->forceit)
+ diff_buf_clear();
+
#ifdef FEAT_SCROLLBIND
/* Remove "hor" from from 'scrollopt' if there are no diff windows left.
*/
if (!diffwin && vim_strchr(p_sbo, 'h') != NULL)
*** ../vim-8.0.0299/src/testdir/test_diffmode.vim 2016-10-18
14:50:14.731694041 +0200
--- src/testdir/test_diffmode.vim 2017-02-03 23:14:15.230019873 +0100
***************
*** 212,217 ****
--- 212,218 ----
call setline(1, ['One', '', 'Two', 'Three'])
diffthis
redraw
+ call assert_notequal(normattr, screenattr(1, 1))
diffoff!
redraw
call assert_equal(normattr, screenattr(1, 1))
***************
*** 219,224 ****
--- 220,261 ----
bwipe!
endfunc
+ func Test_diffoff_hidden()
+ set diffopt=filler,foldcolumn:0
+ e! one
+ call setline(1, ['Two', 'Three'])
+ let normattr = screenattr(1, 1)
+ diffthis
+ botright vert new two
+ call setline(1, ['One', 'Four'])
+ diffthis
+ redraw
+ call assert_notequal(normattr, screenattr(1, 1))
+ set hidden
+ close
+ redraw
+ " diffing with hidden buffer two
+ call assert_notequal(normattr, screenattr(1, 1))
+ diffoff
+ redraw
+ call assert_equal(normattr, screenattr(1, 1))
+ diffthis
+ redraw
+ " still diffing with hidden buffer two
+ call assert_notequal(normattr, screenattr(1, 1))
+ diffoff!
+ redraw
+ call assert_equal(normattr, screenattr(1, 1))
+ diffthis
+ redraw
+ " no longer diffing with hidden buffer two
+ call assert_equal(normattr, screenattr(1, 1))
+
+ bwipe!
+ bwipe!
+ set hidden& diffopt&
+ endfunc
+
func Test_setting_cursor()
new Xtest1
put =range(1,90)
*** ../vim-8.0.0299/src/version.c 2017-02-03 22:01:43.938349448 +0100
--- src/version.c 2017-02-03 23:15:47.253321836 +0100
***************
*** 766,767 ****
--- 766,769 ----
{ /* Add new patch number below this line */
+ /**/
+ 300,
/**/
--
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)
/// Bram Moolenaar -- [email protected] -- 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 ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.