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();
|
newFoldLevel();
|
||||||
curwin = old_curwin;
|
curwin = old_curwin;
|
||||||
|
|
||||||
wp->w_p_diff = TRUE;
|
|
||||||
|
|
||||||
// Use 'scrollbind' and 'cursorbind' when available
|
// 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_save = wp->w_p_scb;
|
||||||
}
|
}
|
||||||
wp->w_p_scb = TRUE;
|
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_save = wp->w_p_crb;
|
||||||
}
|
}
|
||||||
wp->w_p_crb = TRUE;
|
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_save = wp->w_p_wrap;
|
||||||
}
|
}
|
||||||
wp->w_p_wrap = FALSE;
|
wp->w_p_wrap = FALSE;
|
||||||
curwin = wp;
|
curwin = wp;
|
||||||
curbuf = curwin->w_buffer;
|
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);
|
wp->w_p_fdm_save = vim_strsave(wp->w_p_fdm);
|
||||||
}
|
}
|
||||||
set_string_option_direct((char_u *)"fdm", -1, (char_u *)"diff",
|
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;
|
curwin = old_curwin;
|
||||||
curbuf = curwin->w_buffer;
|
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_fdc_save = wp->w_p_fdc;
|
||||||
wp->w_p_fen_save = wp->w_p_fen;
|
wp->w_p_fen_save = wp->w_p_fen;
|
||||||
wp->w_p_fdl_save = wp->w_p_fdl;
|
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().
|
// Saved the current values, to be restored in ex_diffoff().
|
||||||
wp->w_p_diff_saved = TRUE;
|
wp->w_p_diff_saved = TRUE;
|
||||||
|
|
||||||
|
wp->w_p_diff = true;
|
||||||
|
|
||||||
if (addbuf) {
|
if (addbuf) {
|
||||||
diff_buf_add(wp->w_buffer);
|
diff_buf_add(wp->w_buffer);
|
||||||
}
|
}
|
||||||
@ -1116,68 +1119,50 @@ void diff_win_options(win_T *wp, int addbuf)
|
|||||||
/// @param eap
|
/// @param eap
|
||||||
void ex_diffoff(exarg_T *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) {
|
FOR_ALL_WINDOWS_IN_TAB(wp, curtab) {
|
||||||
if (eap->forceit ? wp->w_p_diff : (wp == curwin)) {
|
if (eap->forceit ? wp->w_p_diff : (wp == curwin)) {
|
||||||
// Set 'diff', 'scrollbind' off and 'wrap' on. If option values
|
// Set 'diff' off. If option values were saved in
|
||||||
// were saved in diff_win_options() restore them.
|
// diff_win_options(), restore the ones whose settings seem to have
|
||||||
wp->w_p_diff = FALSE;
|
// been left over from diff mode.
|
||||||
|
wp->w_p_diff = false;
|
||||||
if (wp->w_p_scb) {
|
|
||||||
wp->w_p_scb = wp->w_p_diff_saved ? wp->w_p_scb_save : FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (wp->w_p_crb) {
|
|
||||||
wp->w_p_crb = wp->w_p_diff_saved ? wp->w_p_crb_save : FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!wp->w_p_wrap) {
|
|
||||||
wp->w_p_wrap = wp->w_p_diff_saved ? wp->w_p_wrap_save : TRUE;
|
|
||||||
}
|
|
||||||
curwin = wp;
|
|
||||||
curbuf = curwin->w_buffer;
|
|
||||||
|
|
||||||
if (wp->w_p_diff_saved) {
|
if (wp->w_p_diff_saved) {
|
||||||
|
if (wp->w_p_scb) {
|
||||||
|
wp->w_p_scb = wp->w_p_scb_save;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (wp->w_p_crb) {
|
||||||
|
wp->w_p_crb = wp->w_p_crb_save;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!wp->w_p_wrap) {
|
||||||
|
wp->w_p_wrap = wp->w_p_wrap_save;
|
||||||
|
}
|
||||||
|
|
||||||
free_string_option(wp->w_p_fdm);
|
free_string_option(wp->w_p_fdm);
|
||||||
wp->w_p_fdm = wp->w_p_fdm_save;
|
wp->w_p_fdm = vim_strsave(wp->w_p_fdm_save);
|
||||||
wp->w_p_fdm_save = empty_option;
|
if (wp->w_p_fdc == diff_foldcolumn) {
|
||||||
} else {
|
wp->w_p_fdc = wp->w_p_fdc_save;
|
||||||
set_string_option_direct((char_u *)"fdm", -1,
|
}
|
||||||
(char_u *)"manual", OPT_LOCAL | OPT_FREE, 0);
|
if (wp->w_p_fdl == 0) {
|
||||||
}
|
wp->w_p_fdl = wp->w_p_fdl_save;
|
||||||
curwin = old_curwin;
|
}
|
||||||
curbuf = curwin->w_buffer;
|
|
||||||
|
|
||||||
if (wp->w_p_fdc == diff_foldcolumn) {
|
|
||||||
wp->w_p_fdc = wp->w_p_diff_saved ? wp->w_p_fdc_save : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((wp->w_p_fdl == 0)
|
|
||||||
&& wp->w_p_diff_saved) {
|
|
||||||
wp->w_p_fdl = wp->w_p_fdl_save;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (wp->w_p_fen) {
|
|
||||||
// Only restore 'foldenable' when 'foldmethod' is not
|
// Only restore 'foldenable' when 'foldmethod' is not
|
||||||
// "manual", otherwise we continue to show the diff folds.
|
// "manual", otherwise we continue to show the diff folds.
|
||||||
if (foldmethodIsManual(wp) || !wp->w_p_diff_saved) {
|
if (wp->w_p_fen) {
|
||||||
wp->w_p_fen = FALSE;
|
wp->w_p_fen = foldmethodIsManual(wp) ? false : wp->w_p_fen_save;
|
||||||
} else {
|
|
||||||
wp->w_p_fen = wp->w_p_fen_save;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foldUpdateAll(wp);
|
||||||
|
|
||||||
|
// make sure topline is not halfway through a fold
|
||||||
|
changed_window_setting_win(wp);
|
||||||
}
|
}
|
||||||
|
|
||||||
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.
|
// Note: 'sbo' is not restored, it's a global option.
|
||||||
diff_buf_adjust(wp);
|
diff_buf_adjust(wp);
|
||||||
|
|
||||||
wp->w_p_diff_saved = FALSE;
|
|
||||||
}
|
}
|
||||||
diffwin |= wp->w_p_diff;
|
diffwin |= wp->w_p_diff;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
Tests for vertical splits and filler lines in diff mode
|
Tests for vertical splits and filler lines in diff mode
|
||||||
|
|
||||||
|
Also tests restoration of saved options by :diffoff.
|
||||||
|
|
||||||
STARTTEST
|
STARTTEST
|
||||||
:so small.vim
|
:so small.vim
|
||||||
:" Disable the title to avoid xterm keeping the wrong one.
|
:" Disable the title to avoid xterm keeping the wrong one.
|
||||||
@ -10,8 +12,15 @@ pkdd:w! Xtest
|
|||||||
ddGpkkrXoxxx:w! Xtest2
|
ddGpkkrXoxxx:w! Xtest2
|
||||||
:file Nop
|
:file Nop
|
||||||
ggoyyyjjjozzzz
|
ggoyyyjjjozzzz
|
||||||
|
:set foldmethod=marker foldcolumn=4
|
||||||
|
:redir => nodiffsettings
|
||||||
|
:silent! :set diff? fdm? fdc? scb? crb? wrap?
|
||||||
|
:redir END
|
||||||
:vert diffsplit Xtest
|
:vert diffsplit Xtest
|
||||||
:vert diffsplit Xtest2
|
: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
|
:" jump to second window for a moment to have filler line appear at start of
|
||||||
:" first window
|
:" first window
|
||||||
ggpgg:let one = winline()
|
ggpgg:let one = winline()
|
||||||
@ -36,8 +45,30 @@ j:let three = three . "-" . winline()
|
|||||||
:call append("$", two)
|
:call append("$", two)
|
||||||
:call append("$", three)
|
:call append("$", three)
|
||||||
:$-2,$w! test.out
|
:$-2,$w! test.out
|
||||||
:" Test that diffing shows correct filler lines
|
:"
|
||||||
|
:" Test diffoff
|
||||||
: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!
|
:windo :bw!
|
||||||
:enew
|
:enew
|
||||||
:put =range(4,10)
|
:put =range(4,10)
|
||||||
@ -51,7 +82,7 @@ j:let three = three . "-" . winline()
|
|||||||
:enew
|
:enew
|
||||||
:put =w0
|
:put =w0
|
||||||
:.w >> test.out
|
:.w >> test.out
|
||||||
:unlet! one two three w0
|
:unlet! one two three nodiffsettings diffsettings nd1 nd2 nd3 w0
|
||||||
:qa!
|
:qa!
|
||||||
ENDTEST
|
ENDTEST
|
||||||
|
|
||||||
|
@ -1,4 +1,44 @@
|
|||||||
2-4-5-6-8-9
|
2-4-5-6-8-9
|
||||||
1-2-4-5-8
|
1-2-4-5-8
|
||||||
2-3-4-5-6-7-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
|
1
|
||||||
|
@ -519,8 +519,8 @@ static int included_patches[] = {
|
|||||||
// 772 NA
|
// 772 NA
|
||||||
// 771,
|
// 771,
|
||||||
// 770 NA
|
// 770 NA
|
||||||
// 769,
|
769,
|
||||||
// 768,
|
768,
|
||||||
// 767,
|
// 767,
|
||||||
// 766 NA
|
// 766 NA
|
||||||
765,
|
765,
|
||||||
|
Loading…
Reference in New Issue
Block a user