forked from aniani/vim
patch 8.0.1566: too many #ifdefs
Problem: Too many #ifdefs. Solution: Graduate FEAT_SCROLLBIND and FEAT_CURSORBIND.
This commit is contained in:
16
src/diff.c
16
src/diff.c
@@ -1160,16 +1160,12 @@ diff_win_options(
|
||||
# endif
|
||||
|
||||
/* Use 'scrollbind' and 'cursorbind' when available */
|
||||
#ifdef FEAT_SCROLLBIND
|
||||
if (!wp->w_p_diff)
|
||||
wp->w_p_scb_save = wp->w_p_scb;
|
||||
wp->w_p_scb = TRUE;
|
||||
#endif
|
||||
#ifdef FEAT_CURSORBIND
|
||||
if (!wp->w_p_diff)
|
||||
wp->w_p_crb_save = wp->w_p_crb;
|
||||
wp->w_p_crb = TRUE;
|
||||
#endif
|
||||
if (!wp->w_p_diff)
|
||||
wp->w_p_wrap_save = wp->w_p_wrap;
|
||||
wp->w_p_wrap = FALSE;
|
||||
@@ -1199,10 +1195,8 @@ diff_win_options(
|
||||
/* make sure topline is not halfway a fold */
|
||||
changed_window_setting_win(wp);
|
||||
# endif
|
||||
#ifdef FEAT_SCROLLBIND
|
||||
if (vim_strchr(p_sbo, 'h') == NULL)
|
||||
do_cmdline_cmd((char_u *)"set sbo+=hor");
|
||||
#endif
|
||||
/* Save the current values, to be restored in ex_diffoff(). */
|
||||
wp->w_p_diff_saved = TRUE;
|
||||
|
||||
@@ -1221,9 +1215,7 @@ diff_win_options(
|
||||
ex_diffoff(exarg_T *eap)
|
||||
{
|
||||
win_T *wp;
|
||||
#ifdef FEAT_SCROLLBIND
|
||||
int diffwin = FALSE;
|
||||
#endif
|
||||
|
||||
FOR_ALL_WINDOWS(wp)
|
||||
{
|
||||
@@ -1237,14 +1229,10 @@ ex_diffoff(exarg_T *eap)
|
||||
if (wp->w_p_diff_saved)
|
||||
{
|
||||
|
||||
#ifdef FEAT_SCROLLBIND
|
||||
if (wp->w_p_scb)
|
||||
wp->w_p_scb = wp->w_p_scb_save;
|
||||
#endif
|
||||
#ifdef FEAT_CURSORBIND
|
||||
if (wp->w_p_crb)
|
||||
wp->w_p_crb = wp->w_p_crb_save;
|
||||
#endif
|
||||
if (!wp->w_p_wrap)
|
||||
wp->w_p_wrap = wp->w_p_wrap_save;
|
||||
#ifdef FEAT_FOLDING
|
||||
@@ -1276,20 +1264,16 @@ ex_diffoff(exarg_T *eap)
|
||||
/* Note: 'sbo' is not restored, it's a global option. */
|
||||
diff_buf_adjust(wp);
|
||||
}
|
||||
#ifdef FEAT_SCROLLBIND
|
||||
diffwin |= wp->w_p_diff;
|
||||
#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)
|
||||
do_cmdline_cmd((char_u *)"set sbo-=hor");
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user