mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
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)
25ea054458
This commit is contained in:
parent
f51a397010
commit
d2cbc31185
@ -135,6 +135,20 @@ void diff_buf_add(buf_T *buf)
|
|||||||
EMSGN(_("E96: Cannot diff more than %" PRId64 " buffers"), DB_COUNT);
|
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.
|
/// Find buffer "buf" in the list of diff buffers for the current tab page.
|
||||||
///
|
///
|
||||||
/// @param buf The buffer to find.
|
/// @param buf The buffer to find.
|
||||||
@ -1175,6 +1189,11 @@ void ex_diffoff(exarg_T *eap)
|
|||||||
diffwin |= wp->w_p_diff;
|
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.
|
// Remove "hor" from from 'scrollopt' if there are no diff windows left.
|
||||||
if (!diffwin && (vim_strchr(p_sbo, 'h') != NULL)) {
|
if (!diffwin && (vim_strchr(p_sbo, 'h') != NULL)) {
|
||||||
do_cmdline_cmd("set sbo-=hor");
|
do_cmdline_cmd("set sbo-=hor");
|
||||||
|
@ -212,6 +212,7 @@ func Test_diffoff()
|
|||||||
call setline(1, ['One', '', 'Two', 'Three'])
|
call setline(1, ['One', '', 'Two', 'Three'])
|
||||||
diffthis
|
diffthis
|
||||||
redraw
|
redraw
|
||||||
|
call assert_notequal(normattr, screenattr(1, 1))
|
||||||
diffoff!
|
diffoff!
|
||||||
redraw
|
redraw
|
||||||
call assert_equal(normattr, screenattr(1, 1))
|
call assert_equal(normattr, screenattr(1, 1))
|
||||||
@ -219,6 +220,42 @@ func Test_diffoff()
|
|||||||
bwipe!
|
bwipe!
|
||||||
endfunc
|
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()
|
func Test_setting_cursor()
|
||||||
new Xtest1
|
new Xtest1
|
||||||
put =range(1,90)
|
put =range(1,90)
|
||||||
|
@ -652,7 +652,7 @@ static const int included_patches[] = {
|
|||||||
// 303,
|
// 303,
|
||||||
// 302,
|
// 302,
|
||||||
// 301,
|
// 301,
|
||||||
// 300,
|
300,
|
||||||
// 299,
|
// 299,
|
||||||
// 298,
|
// 298,
|
||||||
297,
|
297,
|
||||||
|
Loading…
Reference in New Issue
Block a user