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.
diff --git a/src/edit.c b/src/edit.c
index 6fd1245..447e2ee 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -1360,7 +1360,7 @@
/* FALLTHROUGH */
case CAR:
case NL:
-#if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX)
+#if defined(FEAT_QUICKFIX)
/* In a quickfix window a <CR> jumps to the error under the
* cursor. */
if (bt_quickfix(curbuf) && c == CAR)
@@ -4045,22 +4045,16 @@
static buf_T *
ins_compl_next_buf(buf_T *buf, int flag)
{
-#ifdef FEAT_WINDOWS
static win_T *wp;
-#endif
if (flag == 'w') /* just windows */
{
-#ifdef FEAT_WINDOWS
if (buf == curbuf) /* first call for this flag/expansion */
wp = curwin;
while ((wp = (wp->w_next != NULL ? wp->w_next : firstwin)) != curwin
&& wp->w_buffer->b_scanned)
;
buf = wp->w_buffer;
-#else
- buf = curbuf;
-#endif
}
else
/* 'b' (just loaded buffers), 'u' (just non-loaded buffers) or 'U'
@@ -8540,7 +8534,7 @@
if (gui.in_use)
gui_update_cursor(TRUE, FALSE);
#endif
-#if defined(FEAT_WINDOWS) && defined(FEAT_KEYMAP)
+#if defined(FEAT_KEYMAP)
/* Show/unshow value of 'keymap' in status lines. */
status_redraw_curbuf();
#endif
@@ -9382,7 +9376,6 @@
tpos = curwin->w_cursor;
if (do_mouse(NULL, c, BACKWARD, 1L, 0))
{
-#ifdef FEAT_WINDOWS
win_T *new_curwin = curwin;
if (curwin != old_curwin && win_valid(old_curwin))
@@ -9392,40 +9385,32 @@
curwin = old_curwin;
curbuf = curwin->w_buffer;
}
-#endif
start_arrow(curwin == old_curwin ? &tpos : NULL);
-#ifdef FEAT_WINDOWS
if (curwin != new_curwin && win_valid(new_curwin))
{
curwin = new_curwin;
curbuf = curwin->w_buffer;
}
-#endif
# ifdef FEAT_CINDENT
can_cindent = TRUE;
# endif
}
-#ifdef FEAT_WINDOWS
/* redraw status lines (in case another window became active) */
redraw_statuslines();
-#endif
}
static void
ins_mousescroll(int dir)
{
pos_T tpos;
-# if defined(FEAT_WINDOWS)
win_T *old_curwin = curwin, *wp;
-# endif
# ifdef FEAT_INS_EXPAND
int did_scroll = FALSE;
# endif
tpos = curwin->w_cursor;
-# ifdef FEAT_WINDOWS
if (mouse_row >= 0 && mouse_col >= 0)
{
int row, col;
@@ -9441,16 +9426,11 @@
curbuf = curwin->w_buffer;
}
if (curwin == old_curwin)
-# endif
undisplay_dollar();
# ifdef FEAT_INS_EXPAND
/* Don't scroll the window in which completion is being done. */
- if (!pum_visible()
-# if defined(FEAT_WINDOWS)
- || curwin != old_curwin
-# endif
- )
+ if (!pum_visible() || curwin != old_curwin)
# endif
{
if (dir == MSCR_DOWN || dir == MSCR_UP)
@@ -9479,12 +9459,10 @@
# endif
}
-# ifdef FEAT_WINDOWS
curwin->w_redr_status = TRUE;
curwin = old_curwin;
curbuf = curwin->w_buffer;
-# endif
# ifdef FEAT_INS_EXPAND
/* The popup menu may overlay the window, need to redraw it.
@@ -9883,7 +9861,6 @@
undisplay_dollar();
-#ifdef FEAT_WINDOWS
if (mod_mask & MOD_MASK_CTRL)
{
/* <C-PageUp>: tab page back */
@@ -9894,7 +9871,6 @@
}
return;
}
-#endif
tpos = curwin->w_cursor;
if (onepage(BACKWARD, 1L) == OK)
@@ -9946,7 +9922,6 @@
undisplay_dollar();
-#ifdef FEAT_WINDOWS
if (mod_mask & MOD_MASK_CTRL)
{
/* <C-PageDown>: tab page forward */
@@ -9957,7 +9932,6 @@
}
return;
}
-#endif
tpos = curwin->w_cursor;
if (onepage(FORWARD, 1L) == OK)