Skip to content

Commit 4033c55

Browse files
committed
patch 8.0.1118: FEAT_WINDOWS adds a lot of #ifdefs
Problem: FEAT_WINDOWS adds a lot of #ifdefs while it is nearly always enabled and only adds 7% to the binary size of the tiny build. Solution: Graduate FEAT_WINDOWS.
1 parent e738a1a commit 4033c55

57 files changed

Lines changed: 237 additions & 1589 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/buffer.c

Lines changed: 21 additions & 100 deletions
Large diffs are not rendered by default.

src/charset.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1092,10 +1092,7 @@ win_lbr_chartabsize(
10921092
&& VIM_ISBREAK(c)
10931093
&& !VIM_ISBREAK((int)s[1])
10941094
&& wp->w_p_wrap
1095-
# ifdef FEAT_WINDOWS
1096-
&& wp->w_width != 0
1097-
# endif
1098-
)
1095+
&& wp->w_width != 0)
10991096
{
11001097
/*
11011098
* Count all characters from first non-blank after a blank up to next
@@ -1249,10 +1246,8 @@ in_win_border(win_T *wp, colnr_T vcol)
12491246
int width1; /* width of first line (after line number) */
12501247
int width2; /* width of further lines */
12511248

1252-
# ifdef FEAT_WINDOWS
12531249
if (wp->w_width == 0) /* there is no border */
12541250
return FALSE;
1255-
# endif
12561251
width1 = W_WIDTH(wp) - win_col_off(wp);
12571252
if ((int)vcol < width1 - 1)
12581253
return FALSE;
@@ -2029,8 +2024,7 @@ hex2nr(int c)
20292024
return c - '0';
20302025
}
20312026

2032-
#if defined(FEAT_TERMRESPONSE) \
2033-
|| (defined(FEAT_GUI_GTK) && defined(FEAT_WINDOWS)) || defined(PROTO)
2027+
#if defined(FEAT_TERMRESPONSE) || defined(FEAT_GUI_GTK) || defined(PROTO)
20342028
/*
20352029
* Convert two hex characters to a byte.
20362030
* Return -1 if one of the characters is not hex.

src/digraph.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2426,9 +2426,7 @@ ex_loadkeymap(exarg_T *eap)
24262426
p_cpo = save_cpo;
24272427

24282428
curbuf->b_kmap_state |= KEYMAP_LOADED;
2429-
#ifdef FEAT_WINDOWS
24302429
status_redraw_curbuf();
2431-
#endif
24322430
}
24332431

24342432
/*
@@ -2462,9 +2460,7 @@ keymap_unload(void)
24622460

24632461
ga_clear(&curbuf->b_kmap_ga);
24642462
curbuf->b_kmap_state &= ~KEYMAP_LOADED;
2465-
#ifdef FEAT_WINDOWS
24662463
status_redraw_curbuf();
2467-
#endif
24682464
}
24692465

24702466
#endif /* FEAT_KEYMAP */

src/edit.c

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1360,7 +1360,7 @@ edit(
13601360
/* FALLTHROUGH */
13611361
case CAR:
13621362
case NL:
1363-
#if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX)
1363+
#if defined(FEAT_QUICKFIX)
13641364
/* In a quickfix window a <CR> jumps to the error under the
13651365
* cursor. */
13661366
if (bt_quickfix(curbuf) && c == CAR)
@@ -4045,22 +4045,16 @@ ins_compl_fixRedoBufForLeader(char_u *ptr_arg)
40454045
static buf_T *
40464046
ins_compl_next_buf(buf_T *buf, int flag)
40474047
{
4048-
#ifdef FEAT_WINDOWS
40494048
static win_T *wp;
4050-
#endif
40514049

40524050
if (flag == 'w') /* just windows */
40534051
{
4054-
#ifdef FEAT_WINDOWS
40554052
if (buf == curbuf) /* first call for this flag/expansion */
40564053
wp = curwin;
40574054
while ((wp = (wp->w_next != NULL ? wp->w_next : firstwin)) != curwin
40584055
&& wp->w_buffer->b_scanned)
40594056
;
40604057
buf = wp->w_buffer;
4061-
#else
4062-
buf = curbuf;
4063-
#endif
40644058
}
40654059
else
40664060
/* 'b' (just loaded buffers), 'u' (just non-loaded buffers) or 'U'
@@ -8540,7 +8534,7 @@ ins_ctrl_hat(void)
85408534
if (gui.in_use)
85418535
gui_update_cursor(TRUE, FALSE);
85428536
#endif
8543-
#if defined(FEAT_WINDOWS) && defined(FEAT_KEYMAP)
8537+
#if defined(FEAT_KEYMAP)
85448538
/* Show/unshow value of 'keymap' in status lines. */
85458539
status_redraw_curbuf();
85468540
#endif
@@ -9382,7 +9376,6 @@ ins_mouse(int c)
93829376
tpos = curwin->w_cursor;
93839377
if (do_mouse(NULL, c, BACKWARD, 1L, 0))
93849378
{
9385-
#ifdef FEAT_WINDOWS
93869379
win_T *new_curwin = curwin;
93879380

93889381
if (curwin != old_curwin && win_valid(old_curwin))
@@ -9392,40 +9385,32 @@ ins_mouse(int c)
93929385
curwin = old_curwin;
93939386
curbuf = curwin->w_buffer;
93949387
}
9395-
#endif
93969388
start_arrow(curwin == old_curwin ? &tpos : NULL);
9397-
#ifdef FEAT_WINDOWS
93989389
if (curwin != new_curwin && win_valid(new_curwin))
93999390
{
94009391
curwin = new_curwin;
94019392
curbuf = curwin->w_buffer;
94029393
}
9403-
#endif
94049394
# ifdef FEAT_CINDENT
94059395
can_cindent = TRUE;
94069396
# endif
94079397
}
94089398

9409-
#ifdef FEAT_WINDOWS
94109399
/* redraw status lines (in case another window became active) */
94119400
redraw_statuslines();
9412-
#endif
94139401
}
94149402

94159403
static void
94169404
ins_mousescroll(int dir)
94179405
{
94189406
pos_T tpos;
9419-
# if defined(FEAT_WINDOWS)
94209407
win_T *old_curwin = curwin, *wp;
9421-
# endif
94229408
# ifdef FEAT_INS_EXPAND
94239409
int did_scroll = FALSE;
94249410
# endif
94259411

94269412
tpos = curwin->w_cursor;
94279413

9428-
# ifdef FEAT_WINDOWS
94299414
if (mouse_row >= 0 && mouse_col >= 0)
94309415
{
94319416
int row, col;
@@ -9441,16 +9426,11 @@ ins_mousescroll(int dir)
94419426
curbuf = curwin->w_buffer;
94429427
}
94439428
if (curwin == old_curwin)
9444-
# endif
94459429
undisplay_dollar();
94469430

94479431
# ifdef FEAT_INS_EXPAND
94489432
/* Don't scroll the window in which completion is being done. */
9449-
if (!pum_visible()
9450-
# if defined(FEAT_WINDOWS)
9451-
|| curwin != old_curwin
9452-
# endif
9453-
)
9433+
if (!pum_visible() || curwin != old_curwin)
94549434
# endif
94559435
{
94569436
if (dir == MSCR_DOWN || dir == MSCR_UP)
@@ -9479,12 +9459,10 @@ ins_mousescroll(int dir)
94799459
# endif
94809460
}
94819461

9482-
# ifdef FEAT_WINDOWS
94839462
curwin->w_redr_status = TRUE;
94849463

94859464
curwin = old_curwin;
94869465
curbuf = curwin->w_buffer;
9487-
# endif
94889466

94899467
# ifdef FEAT_INS_EXPAND
94909468
/* The popup menu may overlay the window, need to redraw it.
@@ -9883,7 +9861,6 @@ ins_pageup(void)
98839861

98849862
undisplay_dollar();
98859863

9886-
#ifdef FEAT_WINDOWS
98879864
if (mod_mask & MOD_MASK_CTRL)
98889865
{
98899866
/* <C-PageUp>: tab page back */
@@ -9894,7 +9871,6 @@ ins_pageup(void)
98949871
}
98959872
return;
98969873
}
9897-
#endif
98989874

98999875
tpos = curwin->w_cursor;
99009876
if (onepage(BACKWARD, 1L) == OK)
@@ -9946,7 +9922,6 @@ ins_pagedown(void)
99469922

99479923
undisplay_dollar();
99489924

9949-
#ifdef FEAT_WINDOWS
99509925
if (mod_mask & MOD_MASK_CTRL)
99519926
{
99529927
/* <C-PageDown>: tab page forward */
@@ -9957,7 +9932,6 @@ ins_pagedown(void)
99579932
}
99589933
return;
99599934
}
9960-
#endif
99619935

99629936
tpos = curwin->w_cursor;
99639937
if (onepage(FORWARD, 1L) == OK)

0 commit comments

Comments
 (0)