Skip to content

Commit 8a3bb56

Browse files
committed
patch 8.0.1566: too many #ifdefs
Problem: Too many #ifdefs. Solution: Graduate FEAT_SCROLLBIND and FEAT_CURSORBIND.
1 parent 107279c commit 8a3bb56

File tree

19 files changed

+19
-142
lines changed

19 files changed

+19
-142
lines changed

src/buffer.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1583,8 +1583,7 @@ do_buffer(
15831583
/* Go to the other buffer. */
15841584
set_curbuf(buf, action);
15851585

1586-
#if defined(FEAT_LISTCMDS) \
1587-
&& (defined(FEAT_SCROLLBIND) || defined(FEAT_CURSORBIND))
1586+
#if defined(FEAT_LISTCMDS)
15881587
if (action == DOBUF_SPLIT)
15891588
{
15901589
RESET_BINDING(curwin); /* reset 'scrollbind' and 'cursorbind' */

src/diff.c

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1160,16 +1160,12 @@ diff_win_options(
11601160
# endif
11611161

11621162
/* Use 'scrollbind' and 'cursorbind' when available */
1163-
#ifdef FEAT_SCROLLBIND
11641163
if (!wp->w_p_diff)
11651164
wp->w_p_scb_save = wp->w_p_scb;
11661165
wp->w_p_scb = TRUE;
1167-
#endif
1168-
#ifdef FEAT_CURSORBIND
11691166
if (!wp->w_p_diff)
11701167
wp->w_p_crb_save = wp->w_p_crb;
11711168
wp->w_p_crb = TRUE;
1172-
#endif
11731169
if (!wp->w_p_diff)
11741170
wp->w_p_wrap_save = wp->w_p_wrap;
11751171
wp->w_p_wrap = FALSE;
@@ -1199,10 +1195,8 @@ diff_win_options(
11991195
/* make sure topline is not halfway a fold */
12001196
changed_window_setting_win(wp);
12011197
# endif
1202-
#ifdef FEAT_SCROLLBIND
12031198
if (vim_strchr(p_sbo, 'h') == NULL)
12041199
do_cmdline_cmd((char_u *)"set sbo+=hor");
1205-
#endif
12061200
/* Save the current values, to be restored in ex_diffoff(). */
12071201
wp->w_p_diff_saved = TRUE;
12081202

@@ -1221,9 +1215,7 @@ diff_win_options(
12211215
ex_diffoff(exarg_T *eap)
12221216
{
12231217
win_T *wp;
1224-
#ifdef FEAT_SCROLLBIND
12251218
int diffwin = FALSE;
1226-
#endif
12271219

12281220
FOR_ALL_WINDOWS(wp)
12291221
{
@@ -1237,14 +1229,10 @@ ex_diffoff(exarg_T *eap)
12371229
if (wp->w_p_diff_saved)
12381230
{
12391231

1240-
#ifdef FEAT_SCROLLBIND
12411232
if (wp->w_p_scb)
12421233
wp->w_p_scb = wp->w_p_scb_save;
1243-
#endif
1244-
#ifdef FEAT_CURSORBIND
12451234
if (wp->w_p_crb)
12461235
wp->w_p_crb = wp->w_p_crb_save;
1247-
#endif
12481236
if (!wp->w_p_wrap)
12491237
wp->w_p_wrap = wp->w_p_wrap_save;
12501238
#ifdef FEAT_FOLDING
@@ -1276,20 +1264,16 @@ ex_diffoff(exarg_T *eap)
12761264
/* Note: 'sbo' is not restored, it's a global option. */
12771265
diff_buf_adjust(wp);
12781266
}
1279-
#ifdef FEAT_SCROLLBIND
12801267
diffwin |= wp->w_p_diff;
1281-
#endif
12821268
}
12831269

12841270
/* Also remove hidden buffers from the list. */
12851271
if (eap->forceit)
12861272
diff_buf_clear();
12871273

1288-
#ifdef FEAT_SCROLLBIND
12891274
/* Remove "hor" from from 'scrollopt' if there are no diff windows left. */
12901275
if (!diffwin && vim_strchr(p_sbo, 'h') != NULL)
12911276
do_cmdline_cmd((char_u *)"set sbo-=hor");
1292-
#endif
12931277
}
12941278

12951279
/*

src/edit.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -764,15 +764,11 @@ edit(
764764
*/
765765
ins_redraw(TRUE);
766766

767-
#ifdef FEAT_SCROLLBIND
768767
if (curwin->w_p_scb)
769768
do_check_scrollbind(TRUE);
770-
#endif
771769

772-
#ifdef FEAT_CURSORBIND
773770
if (curwin->w_p_crb)
774771
do_check_cursorbind();
775-
#endif
776772
update_curswant();
777773
old_topline = curwin->w_topline;
778774
#ifdef FEAT_DIFF

src/evalfunc.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5852,9 +5852,7 @@ f_has(typval_T *argvars, typval_T *rettv)
58525852
#ifdef FEAT_CSCOPE
58535853
"cscope",
58545854
#endif
5855-
#ifdef FEAT_CURSORBIND
58565855
"cursorbind",
5857-
#endif
58585856
#ifdef CURSOR_SHAPE
58595857
"cursorshape",
58605858
#endif
@@ -6104,9 +6102,7 @@ f_has(typval_T *argvars, typval_T *rettv)
61046102
#if defined(FEAT_RUBY) && !defined(DYNAMIC_RUBY)
61056103
"ruby",
61066104
#endif
6107-
#ifdef FEAT_SCROLLBIND
61086105
"scrollbind",
6109-
#endif
61106106
#ifdef FEAT_CMDL_INFO
61116107
"showcmd",
61126108
"cmdline_info",

src/ex_cmds.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4318,9 +4318,7 @@ do_ecmd(
43184318
if (topline == 0 && command == NULL)
43194319
p_so = 999; /* force cursor halfway the window */
43204320
update_topline();
4321-
#ifdef FEAT_SCROLLBIND
43224321
curwin->w_scbind_pos = curwin->w_topline;
4323-
#endif
43244322
p_so = n;
43254323
redraw_curbuf_later(NOT_VALID); /* redraw this buffer later */
43264324
}
@@ -5270,10 +5268,8 @@ do_sub(exarg_T *eap)
52705268
setmouse(); /* disable mouse in xterm */
52715269
#endif
52725270
curwin->w_cursor.col = regmatch.startpos[0].col;
5273-
#ifdef FEAT_CURSORBIND
52745271
if (curwin->w_p_crb)
52755272
do_check_cursorbind();
5276-
#endif
52775273

52785274
/* When 'cpoptions' contains "u" don't sync undo when
52795275
* asking for confirmation. */

src/ex_cmds2.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3232,11 +3232,10 @@ ex_listdo(exarg_T *eap)
32323232
if (eap->cmdidx == CMD_windo)
32333233
{
32343234
validate_cursor(); /* cursor may have moved */
3235-
#ifdef FEAT_SCROLLBIND
3235+
32363236
/* required when 'scrollbind' has been set */
32373237
if (curwin->w_p_scb)
32383238
do_check_scrollbind(TRUE);
3239-
#endif
32403239
}
32413240

32423241
if (eap->cmdidx == CMD_windo || eap->cmdidx == CMD_tabdo)

src/ex_docmd.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8263,20 +8263,18 @@ ex_splitview(exarg_T *eap)
82638263
else if (win_split(eap->addr_count > 0 ? (int)eap->line2 : 0,
82648264
*eap->cmd == 'v' ? WSP_VERT : 0) != FAIL)
82658265
{
8266-
# ifdef FEAT_SCROLLBIND
82678266
/* Reset 'scrollbind' when editing another file, but keep it when
82688267
* doing ":split" without arguments. */
82698268
if (*eap->arg != NUL
8270-
# ifdef FEAT_BROWSE
8269+
# ifdef FEAT_BROWSE
82718270
|| cmdmod.browse
8272-
# endif
8271+
# endif
82738272
)
82748273
{
82758274
RESET_BINDING(curwin);
82768275
}
82778276
else
82788277
do_check_scrollbind(FALSE);
8279-
# endif
82808278
do_exedit(eap, old_curwin);
82818279
}
82828280

@@ -8768,7 +8766,6 @@ ex_swapname(exarg_T *eap UNUSED)
87688766
static void
87698767
ex_syncbind(exarg_T *eap UNUSED)
87708768
{
8771-
#ifdef FEAT_SCROLLBIND
87728769
win_T *wp;
87738770
win_T *save_curwin = curwin;
87748771
buf_T *save_curbuf = curbuf;
@@ -8836,7 +8833,6 @@ ex_syncbind(exarg_T *eap UNUSED)
88368833
ins_typebuf(ctrl_o, REMAP_NONE, 0, TRUE, FALSE);
88378834
}
88388835
}
8839-
#endif
88408836
}
88418837

88428838

src/globals.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -728,15 +728,13 @@ EXTERN colnr_T ai_col INIT(= 0);
728728
EXTERN int end_comment_pending INIT(= NUL);
729729
#endif
730730

731-
#ifdef FEAT_SCROLLBIND
732731
/*
733732
* This flag is set after a ":syncbind" to let the check_scrollbind() function
734733
* know that it should not attempt to perform scrollbinding due to the scroll
735734
* that was a result of the ":syncbind." (Otherwise, check_scrollbind() will
736735
* undo some of the work done by ":syncbind.") -ralston
737736
*/
738737
EXTERN int did_syncbind INIT(= FALSE);
739-
#endif
740738

741739
#ifdef FEAT_SMARTINDENT
742740
/*

src/gui.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3959,9 +3959,7 @@ gui_drag_scrollbar(scrollbar_T *sb, long value, int still_dragging)
39593959
int sb_num;
39603960
#ifdef USE_ON_FLY_SCROLL
39613961
colnr_T old_leftcol = curwin->w_leftcol;
3962-
# ifdef FEAT_SCROLLBIND
39633962
linenr_T old_topline = curwin->w_topline;
3964-
# endif
39653963
# ifdef FEAT_DIFF
39663964
int old_topfill = curwin->w_topfill;
39673965
# endif
@@ -4126,16 +4124,15 @@ gui_drag_scrollbar(scrollbar_T *sb, long value, int still_dragging)
41264124
}
41274125

41284126
#ifdef USE_ON_FLY_SCROLL
4129-
# ifdef FEAT_SCROLLBIND
41304127
/*
41314128
* synchronize other windows, as necessary according to 'scrollbind'
41324129
*/
41334130
if (curwin->w_p_scb
41344131
&& ((sb->wp == NULL && curwin->w_leftcol != old_leftcol)
41354132
|| (sb->wp == curwin && (curwin->w_topline != old_topline
4136-
# ifdef FEAT_DIFF
4133+
# ifdef FEAT_DIFF
41374134
|| curwin->w_topfill != old_topfill
4138-
# endif
4135+
# endif
41394136
))))
41404137
{
41414138
do_check_scrollbind(TRUE);
@@ -4145,7 +4142,6 @@ gui_drag_scrollbar(scrollbar_T *sb, long value, int still_dragging)
41454142
updateWindow(wp);
41464143
setcursor();
41474144
}
4148-
# endif
41494145
out_flush_cursor(FALSE, TRUE);
41504146
#else
41514147
add_to_input_buf(bytes, byte_count);
@@ -4474,9 +4470,7 @@ gui_do_scroll(void)
44744470
}
44754471
if (old_cursor.lnum != wp->w_cursor.lnum)
44764472
coladvance(wp->w_curswant);
4477-
#ifdef FEAT_SCROLLBIND
44784473
wp->w_scbind_pos = wp->w_topline;
4479-
#endif
44804474
}
44814475

44824476
/* Make sure wp->w_leftcol and wp->w_skipcol are correct. */

src/macros.h

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -294,19 +294,7 @@
294294
# define DO_AUTOCHDIR
295295
#endif
296296

297-
#if defined(FEAT_SCROLLBIND) && defined(FEAT_CURSORBIND)
298-
# define RESET_BINDING(wp) (wp)->w_p_scb = FALSE; (wp)->w_p_crb = FALSE
299-
#else
300-
# if defined(FEAT_SCROLLBIND)
301-
# define RESET_BINDING(wp) (wp)->w_p_scb = FALSE
302-
# else
303-
# if defined(FEAT_CURSORBIND)
304-
# define RESET_BINDING(wp) (wp)->w_p_crb = FALSE
305-
# else
306-
# define RESET_BINDING(wp)
307-
# endif
308-
# endif
309-
#endif
297+
#define RESET_BINDING(wp) (wp)->w_p_scb = FALSE; (wp)->w_p_crb = FALSE
310298

311299
#ifdef FEAT_DIFF
312300
# define PLINES_NOFILL(x) plines_nofill(x)

0 commit comments

Comments
 (0)