0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

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.
This commit is contained in:
Bram Moolenaar
2017-09-16 20:54:51 +02:00
parent e738a1a033
commit 4033c55eca
57 changed files with 238 additions and 1590 deletions

View File

@@ -3225,9 +3225,7 @@ do_write(exarg_T *eap)
if (retval == OK)
{
curbuf->b_p_ro = FALSE;
#ifdef FEAT_WINDOWS
redraw_tabline = TRUE;
#endif
}
}
@@ -4153,7 +4151,6 @@ do_ecmd(
#ifdef FEAT_FOLDING
/* It's possible that all lines in the buffer changed. Need to update
* automatic folding for all windows where it's used. */
# ifdef FEAT_WINDOWS
{
win_T *win;
tabpage_T *tp;
@@ -4162,9 +4159,6 @@ do_ecmd(
if (win->w_buffer == curbuf)
foldUpdateAll(win);
}
# else
foldUpdateAll(curwin);
# endif
#endif
/* Change directories when the 'acd' option is set. */
@@ -4284,10 +4278,8 @@ do_ecmd(
}
}
#ifdef FEAT_WINDOWS
/* Check if cursors in other windows on the same buffer are still valid */
check_lnums(FALSE);
#endif
/*
* Did not read the file, need to show some info about the file.
@@ -4583,10 +4575,8 @@ ex_z(exarg_T *eap)
* 'scroll' */
if (eap->forceit)
bigness = curwin->w_height;
#ifdef FEAT_WINDOWS
else if (!ONE_WINDOW)
bigness = curwin->w_height - 3;
#endif
else
bigness = curwin->w_p_scr * 2;
if (bigness < 1)
@@ -6152,7 +6142,7 @@ free_old_sub(void)
}
#endif
#if (defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX)) || defined(PROTO)
#if defined(FEAT_QUICKFIX) || defined(PROTO)
/*
* Set up for a tagpreview.
* Return TRUE when it was created.
@@ -6215,9 +6205,7 @@ ex_help(exarg_T *eap)
FILE *helpfd; /* file descriptor of help file */
int n;
int i;
#ifdef FEAT_WINDOWS
win_T *wp;
#endif
int num_matches;
char_u **matches;
char_u *p;
@@ -6319,13 +6307,8 @@ ex_help(exarg_T *eap)
* Re-use an existing help window or open a new one.
* Always open a new one for ":tab help".
*/
if (!bt_help(curwin->w_buffer)
#ifdef FEAT_WINDOWS
|| cmdmod.tab != 0
#endif
)
if (!bt_help(curwin->w_buffer) || cmdmod.tab != 0)
{
#ifdef FEAT_WINDOWS
if (cmdmod.tab != 0)
wp = NULL;
else
@@ -6335,7 +6318,6 @@ ex_help(exarg_T *eap)
if (wp != NULL && wp->w_buffer->b_nwindows > 0)
win_enter(wp, TRUE);
else
#endif
{
/*
* There is no help window yet.
@@ -6348,7 +6330,6 @@ ex_help(exarg_T *eap)
}
fclose(helpfd);
#ifdef FEAT_WINDOWS
/* Split off help window; put it at far top if no position
* specified, the current window is vertically split and
* narrow. */
@@ -6358,16 +6339,9 @@ ex_help(exarg_T *eap)
n |= WSP_TOP;
if (win_split(0, n) == FAIL)
goto erret;
#else
/* use current window */
if (!can_abandon(curbuf, FALSE))
goto erret;
#endif
#ifdef FEAT_WINDOWS
if (curwin->w_height < p_hh)
win_setheight((int)p_hh);
#endif
/*
* Open help file (do_ecmd() will set b_help flag, readfile() will
@@ -6377,12 +6351,7 @@ ex_help(exarg_T *eap)
alt_fnum = curbuf->b_fnum;
(void)do_ecmd(0, NULL, NULL, NULL, ECMD_LASTL,
ECMD_HIDE + ECMD_SET_HELP,
#ifdef FEAT_WINDOWS
NULL /* buffer is still open, don't store info */
#else
curwin
#endif
);
NULL); /* buffer is still open, don't store info */
if (!cmdmod.keepalt)
curwin->w_alt_fnum = alt_fnum;
empty_fnum = curbuf->b_fnum;
@@ -6425,7 +6394,6 @@ erret:
void
ex_helpclose(exarg_T *eap UNUSED)
{
#if defined(FEAT_WINDOWS)
win_T *win;
FOR_ALL_WINDOWS(win)
@@ -6436,7 +6404,6 @@ ex_helpclose(exarg_T *eap UNUSED)
return;
}
}
#endif
}
#if defined(FEAT_MULTI_LANG) || defined(PROTO)
@@ -8350,9 +8317,7 @@ ex_drop(exarg_T *eap)
int split = FALSE;
win_T *wp;
buf_T *buf;
# ifdef FEAT_WINDOWS
tabpage_T *tp;
# endif
/*
* Check if the first argument is already being edited in a window. If
@@ -8372,7 +8337,6 @@ ex_drop(exarg_T *eap)
if (ARGCOUNT == 0)
return;
# ifdef FEAT_WINDOWS
if (cmdmod.tab)
{
/* ":tab drop file ...": open a tab for each argument that isn't
@@ -8381,7 +8345,6 @@ ex_drop(exarg_T *eap)
ex_all(eap);
}
else
# endif
{
/* ":drop file ...": Edit the first argument. Jump to an existing
* window if possible, edit in current window if the current buffer
@@ -8392,9 +8355,7 @@ ex_drop(exarg_T *eap)
{
if (wp->w_buffer == buf)
{
# ifdef FEAT_WINDOWS
goto_tabpage_win(tp, wp);
# endif
curwin->w_arg_idx = 0;
return;
}
@@ -8408,16 +8369,9 @@ ex_drop(exarg_T *eap)
*/
if (!buf_hide(curbuf))
{
# ifdef FEAT_WINDOWS
++emsg_off;
# endif
split = check_changed(curbuf, CCGD_AW | CCGD_EXCMD);
# ifdef FEAT_WINDOWS
--emsg_off;
# else
if (split)
return;
# endif
}
/* Fake a ":sfirst" or ":first" command edit the first argument. */