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/fileio.c b/src/fileio.c
index 87a46b1..0d1ac2d 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -4174,9 +4174,7 @@
#ifdef FEAT_TITLE
need_maketitle = TRUE; /* set window title later */
#endif
-#ifdef FEAT_WINDOWS
status_redraw_all(); /* redraw status lines later */
-#endif
}
if (end > buf->b_ml.ml_line_count)
@@ -6197,10 +6195,8 @@
* also have a swap file. */
mf_fullname(buf->b_ml.ml_mfp);
}
-#ifdef FEAT_WINDOWS
status_redraw_all();
redraw_tabline = TRUE;
-#endif
}
#if (defined(FEAT_DND) && defined(FEAT_GUI_GTK)) \
@@ -8963,9 +8959,7 @@
buf_T *buf) /* new curbuf */
{
win_T *win;
-#ifdef FEAT_WINDOWS
int save_ea;
-#endif
#ifdef FEAT_AUTOCHDIR
int save_acd;
#endif
@@ -8974,13 +8968,9 @@
if (buf == curbuf) /* be quick when buf is curbuf */
win = curwin;
else
-#ifdef FEAT_WINDOWS
FOR_ALL_WINDOWS(win)
if (win->w_buffer == buf)
break;
-#else
- win = NULL;
-#endif
/* Allocate "aucmd_win" when needed. If this fails (out of memory) fall
* back to using the current window. */
@@ -9026,7 +9016,6 @@
globaldir = NULL;
-#ifdef FEAT_WINDOWS
/* Split the current window, put the aucmd_win in the upper half.
* We don't want the BufEnter or WinEnter autocommands. */
block_autocmds();
@@ -9034,20 +9023,19 @@
save_ea = p_ea;
p_ea = FALSE;
-# ifdef FEAT_AUTOCHDIR
+#ifdef FEAT_AUTOCHDIR
/* Prevent chdir() call in win_enter_ext(), through do_autochdir(). */
save_acd = p_acd;
p_acd = FALSE;
-# endif
+#endif
(void)win_split_ins(0, WSP_TOP, aucmd_win, 0);
(void)win_comp_pos(); /* recompute window positions */
p_ea = save_ea;
-# ifdef FEAT_AUTOCHDIR
+#ifdef FEAT_AUTOCHDIR
p_acd = save_acd;
-# endif
- unblock_autocmds();
#endif
+ unblock_autocmds();
curwin = aucmd_win;
}
curbuf = buf;
@@ -9064,14 +9052,11 @@
aucmd_restbuf(
aco_save_T *aco) /* structure holding saved values */
{
-#ifdef FEAT_WINDOWS
int dummy;
-#endif
if (aco->use_aucmd_win)
{
--curbuf->b_nwindows;
-#ifdef FEAT_WINDOWS
/* Find "aucmd_win", it can't be closed, but it may be in another tab
* page. Do not trigger autocommands here. */
block_autocmds();
@@ -9112,12 +9097,9 @@
else
/* Hmm, original window disappeared. Just use the first one. */
curwin = firstwin;
-# ifdef FEAT_EVAL
+#ifdef FEAT_EVAL
vars_clear(&aucmd_win->w_vars->dv_hashtab); /* free all w: variables */
hash_init(&aucmd_win->w_vars->dv_hashtab); /* re-use the hashtab */
-# endif
-#else
- curwin = aco->save_curwin;
#endif
curbuf = curwin->w_buffer;
@@ -9143,9 +9125,7 @@
else
{
/* restore curwin */
-#ifdef FEAT_WINDOWS
if (win_valid(aco->save_curwin))
-#endif
{
/* Restore the buffer which was previously edited by curwin, if
* it was changed, we are still the same window and the buffer is