window: refactor boolean variables in win_close()

free_buf (param) and help_window (variable) are bool.
This commit is contained in:
Jan Edmund Lazo
2018-09-06 20:12:15 -04:00
parent dc15dcffad
commit cfb2828897
7 changed files with 18 additions and 20 deletions

View File

@@ -842,7 +842,7 @@ void goto_buffer(exarg_T *eap, int start, int dir, int count)
enter_cleanup(&cs); enter_cleanup(&cs);
/* Quitting means closing the split window, nothing else. */ /* Quitting means closing the split window, nothing else. */
win_close(curwin, TRUE); win_close(curwin, true);
swap_exists_action = SEA_NONE; swap_exists_action = SEA_NONE;
swap_exists_did_quit = TRUE; swap_exists_did_quit = TRUE;
@@ -4651,7 +4651,7 @@ void ex_buffer_all(exarg_T *eap)
&& !ONE_WINDOW && !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);
wpnext = firstwin; /* just in case an autocommand does wpnext = firstwin; /* just in case an autocommand does
something strange with windows */ something strange with windows */
tpnext = first_tabpage; /* start all over...*/ tpnext = first_tabpage; /* start all over...*/
@@ -4724,7 +4724,7 @@ void ex_buffer_all(exarg_T *eap)
enter_cleanup(&cs); enter_cleanup(&cs);
/* User selected Quit at ATTENTION prompt; close this window. */ /* User selected Quit at ATTENTION prompt; close this window. */
win_close(curwin, TRUE); win_close(curwin, true);
--open_wins; --open_wins;
swap_exists_action = SEA_NONE; swap_exists_action = SEA_NONE;
swap_exists_did_quit = TRUE; swap_exists_did_quit = TRUE;

View File

@@ -5510,7 +5510,7 @@ void ex_helpclose(exarg_T *eap)
{ {
FOR_ALL_WINDOWS_IN_TAB(win, curtab) { FOR_ALL_WINDOWS_IN_TAB(win, curtab) {
if (bt_help(win->w_buffer)) { if (bt_help(win->w_buffer)) {
win_close(win, FALSE); win_close(win, false);
return; return;
} }
} }

View File

@@ -6192,7 +6192,7 @@ static int open_cmdwin(void)
wp = curwin; wp = curwin;
set_bufref(&bufref, curbuf); set_bufref(&bufref, curbuf);
win_goto(old_curwin); win_goto(old_curwin);
win_close(wp, TRUE); win_close(wp, true);
// win_close() may have already wiped the buffer when 'bh' is // win_close() may have already wiped the buffer when 'bh' is
// set to 'wipe'. // set to 'wipe'.

View File

@@ -1551,7 +1551,7 @@ static void edit_buffers(mparm_T *parmp, char_u *cwd)
/* When w_arg_idx is -1 remove the window (see create_windows()). */ /* When w_arg_idx is -1 remove the window (see create_windows()). */
if (curwin->w_arg_idx == -1) { if (curwin->w_arg_idx == -1) {
win_close(curwin, TRUE); win_close(curwin, true);
advance = FALSE; advance = FALSE;
} }
@@ -1563,7 +1563,7 @@ static void edit_buffers(mparm_T *parmp, char_u *cwd)
// When w_arg_idx is -1 remove the window (see create_windows()). // When w_arg_idx is -1 remove the window (see create_windows()).
if (curwin->w_arg_idx == -1) { if (curwin->w_arg_idx == -1) {
++arg_idx; ++arg_idx;
win_close(curwin, TRUE); win_close(curwin, true);
advance = FALSE; advance = FALSE;
continue; continue;
} }
@@ -1598,7 +1598,7 @@ static void edit_buffers(mparm_T *parmp, char_u *cwd)
did_emsg = FALSE; /* avoid hit-enter prompt */ did_emsg = FALSE; /* avoid hit-enter prompt */
getout(1); getout(1);
} }
win_close(curwin, TRUE); win_close(curwin, true);
advance = FALSE; advance = FALSE;
} }
if (arg_idx == GARGCOUNT - 1) if (arg_idx == GARGCOUNT - 1)

View File

@@ -2598,7 +2598,7 @@ void ex_cclose(exarg_T *eap)
/* Find existing quickfix window and close it. */ /* Find existing quickfix window and close it. */
win = qf_find_win(qi); win = qf_find_win(qi);
if (win != NULL) if (win != NULL)
win_close(win, FALSE); win_close(win, false);
} }
/* /*

View File

@@ -2612,7 +2612,7 @@ static int jumpto_tag(
} else { } else {
--RedrawingDisabled; --RedrawingDisabled;
if (postponed_split) { /* close the window */ if (postponed_split) { /* close the window */
win_close(curwin, FALSE); win_close(curwin, false);
postponed_split = 0; postponed_split = 0;
} }
} }

View File

@@ -1859,20 +1859,18 @@ static bool close_last_window_tabpage(win_T *win, bool free_buf,
return true; return true;
} }
/* // Close window "win". Only works for the current tab page.
* Close window "win". Only works for the current tab page. // If "free_buf" is true related buffer may be unloaded.
* If "free_buf" is TRUE related buffer may be unloaded. //
* // Called by :quit, :close, :xit, :wq and findtag().
* Called by :quit, :close, :xit, :wq and findtag(). // Returns FAIL when the window was not closed.
* Returns FAIL when the window was not closed. int win_close(win_T *win, bool free_buf)
*/
int win_close(win_T *win, int free_buf)
{ {
win_T *wp; win_T *wp;
int other_buffer = FALSE; int other_buffer = FALSE;
int close_curwin = FALSE; int close_curwin = FALSE;
int dir; int dir;
int help_window = FALSE; bool help_window = false;
tabpage_T *prev_curtab = curtab; tabpage_T *prev_curtab = curtab;
frame_T *win_frame = win->w_frame->fr_parent; frame_T *win_frame = win->w_frame->fr_parent;
@@ -1903,7 +1901,7 @@ int win_close(win_T *win, int free_buf)
/* When closing the help window, try restoring a snapshot after closing /* When closing the help window, try restoring a snapshot after closing
* the window. Otherwise clear the snapshot, it's now invalid. */ * the window. Otherwise clear the snapshot, it's now invalid. */
if (bt_help(win->w_buffer)) if (bt_help(win->w_buffer))
help_window = TRUE; help_window = true;
else else
clear_snapshot(curtab, SNAP_HELP_IDX); clear_snapshot(curtab, SNAP_HELP_IDX);