vim-patch:8.0.0073

Problem:    More comparisons between firstwin and lastwin.
Solution:   Use ONE_WINDOW for consistency. (Hirohito Higashi)

459ca56312
This commit is contained in:
ckelsel
2017-07-23 11:11:56 +08:00
parent ad07e9c7fc
commit b656159fcf
6 changed files with 16 additions and 16 deletions

View File

@@ -1203,7 +1203,7 @@ do_buffer (
*/ */
while (buf == curbuf while (buf == curbuf
&& !(curwin->w_closing || curwin->w_buffer->b_locked > 0) && !(curwin->w_closing || curwin->w_buffer->b_locked > 0)
&& (firstwin != lastwin || first_tabpage->tp_next != NULL)) { && (!ONE_WINDOW || first_tabpage->tp_next != NULL)) {
if (win_close(curwin, FALSE) == FAIL) if (win_close(curwin, FALSE) == FAIL)
break; break;
} }
@@ -4593,7 +4593,7 @@ void ex_buffer_all(exarg_T *eap)
- tabline_height() - tabline_height()
: wp->w_width != Columns) : wp->w_width != Columns)
|| (had_tab > 0 && wp != firstwin)) || (had_tab > 0 && wp != firstwin))
&& firstwin != lastwin && !ONE_WINDOW
&& !(wp->w_closing || wp->w_buffer->b_locked > 0) && !(wp->w_closing || wp->w_buffer->b_locked > 0)
) { ) {
win_close(wp, FALSE); win_close(wp, FALSE);

View File

@@ -6176,9 +6176,9 @@ void tabpage_close(int forceit)
{ {
/* First close all the windows but the current one. If that worked then /* First close all the windows but the current one. If that worked then
* close the last window in this tab, that will close it. */ * close the last window in this tab, that will close it. */
if (lastwin != firstwin) if (!ONE_WINDOW)
close_others(TRUE, forceit); close_others(TRUE, forceit);
if (lastwin == firstwin) if (ONE_WINDOW)
ex_win_close(forceit, curwin, NULL); ex_win_close(forceit, curwin, NULL);
} }

View File

@@ -585,7 +585,7 @@ void free_all_mem(void)
p_ea = false; p_ea = false;
if (first_tabpage->tp_next != NULL) if (first_tabpage->tp_next != NULL)
do_cmdline_cmd("tabonly!"); do_cmdline_cmd("tabonly!");
if (firstwin != lastwin) if (!ONE_WINDOW)
do_cmdline_cmd("only!"); do_cmdline_cmd("only!");
/* Free all spell info. */ /* Free all spell info. */

View File

@@ -4078,7 +4078,7 @@ static char *set_num_option(int opt_idx, char_u *varp, long value,
} }
/* Change window height NOW */ /* Change window height NOW */
if (lastwin != firstwin) { if (!ONE_WINDOW) {
if (pp == &p_wh && curwin->w_height < p_wh) if (pp == &p_wh && curwin->w_height < p_wh)
win_setheight((int)p_wh); win_setheight((int)p_wh);
if (pp == &p_hh && curbuf->b_help && curwin->w_height < p_hh) if (pp == &p_hh && curbuf->b_help && curwin->w_height < p_hh)
@@ -4107,7 +4107,7 @@ static char *set_num_option(int opt_idx, char_u *varp, long value,
} }
/* Change window width NOW */ /* Change window width NOW */
if (lastwin != firstwin && curwin->w_width < p_wiw) if (!ONE_WINDOW && curwin->w_width < p_wiw)
win_setwidth((int)p_wiw); win_setwidth((int)p_wiw);
} }
/* 'winminwidth' */ /* 'winminwidth' */
@@ -5239,7 +5239,7 @@ static int put_setbool(FILE *fd, char *cmd, char *name, int value)
void comp_col(void) void comp_col(void)
{ {
int last_has_status = (p_ls == 2 || (p_ls == 1 && firstwin != lastwin)); int last_has_status = (p_ls == 2 || (p_ls == 1 && !ONE_WINDOW));
sc_col = 0; sc_col = 0;
ru_col = 0; ru_col = 0;

View File

@@ -656,7 +656,7 @@ static const int included_patches[] = {
// 76 NA // 76 NA
// 75, // 75,
// 74, // 74,
// 73, 73,
// 72 NA // 72 NA
// 71 NA // 71 NA
// 70 NA // 70 NA

View File

@@ -574,7 +574,7 @@ int win_split_ins(int size, int flags, win_T *new_wp, int dir)
oldwin = curwin; oldwin = curwin;
/* add a status line when p_ls == 1 and splitting the first window */ /* add a status line when p_ls == 1 and splitting the first window */
if (lastwin == firstwin && p_ls == 1 && oldwin->w_status_height == 0) { if (ONE_WINDOW && p_ls == 1 && oldwin->w_status_height == 0) {
if (oldwin->w_height <= p_wmh && new_wp == NULL) { if (oldwin->w_height <= p_wmh && new_wp == NULL) {
EMSG(_(e_noroom)); EMSG(_(e_noroom));
return FAIL; return FAIL;
@@ -1182,7 +1182,7 @@ static void win_exchange(long Prenum)
win_T *wp2; win_T *wp2;
int temp; int temp;
if (lastwin == firstwin) { /* just one window */ if (ONE_WINDOW) { /* just one window */
beep_flush(); beep_flush();
return; return;
} }
@@ -1343,7 +1343,7 @@ static void win_totop(int size, int flags)
int dir; int dir;
int height = curwin->w_height; int height = curwin->w_height;
if (lastwin == firstwin) { if (ONE_WINDOW) {
beep_flush(); beep_flush();
return; return;
} }
@@ -1728,7 +1728,7 @@ void close_windows(buf_T *buf, int keep_curwin)
++RedrawingDisabled; ++RedrawingDisabled;
for (win_T *wp = firstwin; wp != NULL && lastwin != firstwin; ) { for (win_T *wp = firstwin; wp != NULL && !ONE_WINDOW; ) {
if (wp->w_buffer == buf && (!keep_curwin || wp != curwin) if (wp->w_buffer == buf && (!keep_curwin || wp != curwin)
&& !(wp->w_closing || wp->w_buffer->b_locked > 0)) { && !(wp->w_closing || wp->w_buffer->b_locked > 0)) {
if (win_close(wp, false) == FAIL) { if (win_close(wp, false) == FAIL) {
@@ -1810,7 +1810,7 @@ static bool close_last_window_tabpage(win_T *win, bool free_buf,
tabpage_T *prev_curtab) tabpage_T *prev_curtab)
FUNC_ATTR_NONNULL_ARG(1) FUNC_ATTR_NONNULL_ARG(1)
{ {
if (firstwin != lastwin) { if (!ONE_WINDOW) {
return false; return false;
} }
buf_T *old_curbuf = curbuf; buf_T *old_curbuf = curbuf;
@@ -2851,7 +2851,7 @@ close_others (
win_close(wp, !P_HID(wp->w_buffer) && !bufIsChanged(wp->w_buffer)); win_close(wp, !P_HID(wp->w_buffer) && !bufIsChanged(wp->w_buffer));
} }
if (message && lastwin != firstwin) if (message && !ONE_WINDOW)
EMSG(_("E445: Other window contains changes")); EMSG(_("E445: Other window contains changes"));
} }
@@ -5173,7 +5173,7 @@ last_status (
{ {
/* Don't make a difference between horizontal or vertical split. */ /* Don't make a difference between horizontal or vertical split. */
last_status_rec(topframe, (p_ls == 2 last_status_rec(topframe, (p_ls == 2
|| (p_ls == 1 && (morewin || lastwin != firstwin)))); || (p_ls == 1 && (morewin || !ONE_WINDOW))));
} }
static void last_status_rec(frame_T *fr, int statusline) static void last_status_rec(frame_T *fr, int statusline)