mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
Merge #4139 'vim-patch:7.4.{768,769}'.
This commit is contained in:
commit
39e5d9287e
@ -1057,27 +1057,28 @@ void diff_win_options(win_T *wp, int addbuf)
|
||||
newFoldLevel();
|
||||
curwin = old_curwin;
|
||||
|
||||
wp->w_p_diff = TRUE;
|
||||
|
||||
// Use 'scrollbind' and 'cursorbind' when available
|
||||
if (!wp->w_p_diff_saved) {
|
||||
if (!wp->w_p_diff) {
|
||||
wp->w_p_scb_save = wp->w_p_scb;
|
||||
}
|
||||
wp->w_p_scb = TRUE;
|
||||
|
||||
if (!wp->w_p_diff_saved) {
|
||||
if (!wp->w_p_diff) {
|
||||
wp->w_p_crb_save = wp->w_p_crb;
|
||||
}
|
||||
wp->w_p_crb = TRUE;
|
||||
|
||||
if (!wp->w_p_diff_saved) {
|
||||
if (!wp->w_p_diff) {
|
||||
wp->w_p_wrap_save = wp->w_p_wrap;
|
||||
}
|
||||
wp->w_p_wrap = FALSE;
|
||||
curwin = wp;
|
||||
curbuf = curwin->w_buffer;
|
||||
|
||||
if (!wp->w_p_diff_saved) {
|
||||
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",
|
||||
@ -1085,7 +1086,7 @@ void diff_win_options(win_T *wp, int addbuf)
|
||||
curwin = old_curwin;
|
||||
curbuf = curwin->w_buffer;
|
||||
|
||||
if (!wp->w_p_diff_saved) {
|
||||
if (!wp->w_p_diff) {
|
||||
wp->w_p_fdc_save = wp->w_p_fdc;
|
||||
wp->w_p_fen_save = wp->w_p_fen;
|
||||
wp->w_p_fdl_save = wp->w_p_fdl;
|
||||
@ -1104,6 +1105,8 @@ void diff_win_options(win_T *wp, int addbuf)
|
||||
// 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);
|
||||
}
|
||||
@ -1116,68 +1119,50 @@ void diff_win_options(win_T *wp, int addbuf)
|
||||
/// @param eap
|
||||
void ex_diffoff(exarg_T *eap)
|
||||
{
|
||||
win_T *old_curwin = curwin;
|
||||
int diffwin = FALSE;
|
||||
int diffwin = false;
|
||||
|
||||
FOR_ALL_WINDOWS_IN_TAB(wp, curtab) {
|
||||
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;
|
||||
// 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) {
|
||||
if (wp->w_p_scb) {
|
||||
wp->w_p_scb = wp->w_p_diff_saved ? wp->w_p_scb_save : FALSE;
|
||||
wp->w_p_scb = wp->w_p_scb_save;
|
||||
}
|
||||
|
||||
if (wp->w_p_crb) {
|
||||
wp->w_p_crb = wp->w_p_diff_saved ? wp->w_p_crb_save : FALSE;
|
||||
wp->w_p_crb = wp->w_p_crb_save;
|
||||
}
|
||||
|
||||
if (!wp->w_p_wrap) {
|
||||
wp->w_p_wrap = wp->w_p_diff_saved ? wp->w_p_wrap_save : TRUE;
|
||||
wp->w_p_wrap = wp->w_p_wrap_save;
|
||||
}
|
||||
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;
|
||||
|
||||
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_diff_saved ? wp->w_p_fdc_save : 0;
|
||||
wp->w_p_fdc = wp->w_p_fdc_save;
|
||||
}
|
||||
|
||||
if ((wp->w_p_fdl == 0)
|
||||
&& wp->w_p_diff_saved) {
|
||||
if (wp->w_p_fdl == 0) {
|
||||
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;
|
||||
}
|
||||
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 through a fold
|
||||
changed_window_setting_win(wp);
|
||||
}
|
||||
|
||||
// Note: 'sbo' is not restored, it's a global option.
|
||||
diff_buf_adjust(wp);
|
||||
|
||||
wp->w_p_diff_saved = FALSE;
|
||||
}
|
||||
diffwin |= wp->w_p_diff;
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
Tests for vertical splits and filler lines in diff mode
|
||||
|
||||
Also tests restoration of saved options by :diffoff.
|
||||
|
||||
STARTTEST
|
||||
:so small.vim
|
||||
:" Disable the title to avoid xterm keeping the wrong one.
|
||||
@ -10,8 +12,15 @@ pkdd:w! Xtest
|
||||
ddGpkkrXoxxx:w! Xtest2
|
||||
:file Nop
|
||||
ggoyyyjjjozzzz
|
||||
:set foldmethod=marker foldcolumn=4
|
||||
:redir => nodiffsettings
|
||||
:silent! :set diff? fdm? fdc? scb? crb? wrap?
|
||||
:redir END
|
||||
:vert diffsplit Xtest
|
||||
:vert diffsplit Xtest2
|
||||
:redir => diffsettings
|
||||
:silent! :set diff? fdm? fdc? scb? crb? wrap?
|
||||
:redir END
|
||||
:" jump to second window for a moment to have filler line appear at start of
|
||||
:" first window
|
||||
ggpgg:let one = winline()
|
||||
@ -36,8 +45,30 @@ j:let three = three . "-" . winline()
|
||||
:call append("$", two)
|
||||
:call append("$", three)
|
||||
:$-2,$w! test.out
|
||||
:" Test that diffing shows correct filler lines
|
||||
:"
|
||||
:" Test diffoff
|
||||
:diffoff!
|
||||
:$put =nodiffsettings
|
||||
:$put =diffsettings
|
||||
1
|
||||
:redir => nd1
|
||||
:silent! :set diff? fdm? fdc? scb? crb? wrap?
|
||||
:redir END
|
||||
|
||||
:redir => nd2
|
||||
:silent! :set diff? fdm? fdc? scb? crb? wrap?
|
||||
:redir END
|
||||
|
||||
:redir => nd3
|
||||
:silent! :set diff? fdm? fdc? scb? crb? wrap?
|
||||
:redir END
|
||||
|
||||
:$put =nd1
|
||||
:$put =nd2
|
||||
:$put =nd3
|
||||
:$-39,$w >> test.out
|
||||
:"
|
||||
:" Test that diffing shows correct filler lines
|
||||
:windo :bw!
|
||||
:enew
|
||||
:put =range(4,10)
|
||||
@ -51,7 +82,7 @@ j:let three = three . "-" . winline()
|
||||
:enew
|
||||
:put =w0
|
||||
:.w >> test.out
|
||||
:unlet! one two three w0
|
||||
:unlet! one two three nodiffsettings diffsettings nd1 nd2 nd3 w0
|
||||
:qa!
|
||||
ENDTEST
|
||||
|
||||
|
@ -1,4 +1,44 @@
|
||||
2-4-5-6-8-9
|
||||
1-2-4-5-8
|
||||
2-3-4-5-6-7-8
|
||||
|
||||
|
||||
nodiff
|
||||
foldmethod=marker
|
||||
foldcolumn=4
|
||||
noscrollbind
|
||||
nocursorbind
|
||||
wrap
|
||||
|
||||
|
||||
diff
|
||||
foldmethod=diff
|
||||
foldcolumn=2
|
||||
scrollbind
|
||||
cursorbind
|
||||
nowrap
|
||||
|
||||
|
||||
nodiff
|
||||
foldmethod=marker
|
||||
foldcolumn=4
|
||||
noscrollbind
|
||||
nocursorbind
|
||||
wrap
|
||||
|
||||
|
||||
nodiff
|
||||
foldmethod=marker
|
||||
foldcolumn=4
|
||||
noscrollbind
|
||||
nocursorbind
|
||||
wrap
|
||||
|
||||
|
||||
nodiff
|
||||
foldmethod=marker
|
||||
foldcolumn=4
|
||||
noscrollbind
|
||||
nocursorbind
|
||||
wrap
|
||||
1
|
||||
|
@ -519,8 +519,8 @@ static int included_patches[] = {
|
||||
// 772 NA
|
||||
// 771,
|
||||
// 770 NA
|
||||
// 769,
|
||||
// 768,
|
||||
769,
|
||||
768,
|
||||
// 767,
|
||||
// 766 NA
|
||||
765,
|
||||
|
Loading…
Reference in New Issue
Block a user