diff options
author | Jan Edmund Lazo <janedmundlazo@hotmail.com> | 2018-09-06 20:12:15 -0400 |
---|---|---|
committer | Jan Edmund Lazo <janedmundlazo@hotmail.com> | 2018-09-06 20:24:29 -0400 |
commit | cfb2828897119df1a7d59f883d151b67609b8361 (patch) | |
tree | 3be5031b3aade722e195758286d6f8a107c61a9b | |
parent | dc15dcffadca790a7b274110c0b356dcc22dfb82 (diff) | |
download | rneovim-cfb2828897119df1a7d59f883d151b67609b8361.tar.gz rneovim-cfb2828897119df1a7d59f883d151b67609b8361.tar.bz2 rneovim-cfb2828897119df1a7d59f883d151b67609b8361.zip |
window: refactor boolean variables in win_close()
free_buf (param) and help_window (variable) are bool.
-rw-r--r-- | src/nvim/buffer.c | 6 | ||||
-rw-r--r-- | src/nvim/ex_cmds.c | 2 | ||||
-rw-r--r-- | src/nvim/ex_getln.c | 2 | ||||
-rw-r--r-- | src/nvim/main.c | 6 | ||||
-rw-r--r-- | src/nvim/quickfix.c | 2 | ||||
-rw-r--r-- | src/nvim/tag.c | 2 | ||||
-rw-r--r-- | src/nvim/window.c | 18 |
7 files changed, 18 insertions, 20 deletions
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index 9815063633..5f832bfcf3 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -842,7 +842,7 @@ void goto_buffer(exarg_T *eap, int start, int dir, int count) enter_cleanup(&cs); /* Quitting means closing the split window, nothing else. */ - win_close(curwin, TRUE); + win_close(curwin, true); swap_exists_action = SEA_NONE; swap_exists_did_quit = TRUE; @@ -4651,7 +4651,7 @@ void ex_buffer_all(exarg_T *eap) && !ONE_WINDOW && !(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 something strange with windows */ tpnext = first_tabpage; /* start all over...*/ @@ -4724,7 +4724,7 @@ void ex_buffer_all(exarg_T *eap) enter_cleanup(&cs); /* User selected Quit at ATTENTION prompt; close this window. */ - win_close(curwin, TRUE); + win_close(curwin, true); --open_wins; swap_exists_action = SEA_NONE; swap_exists_did_quit = TRUE; diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index 4d32b76eb0..ac5b3af459 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -5510,7 +5510,7 @@ void ex_helpclose(exarg_T *eap) { FOR_ALL_WINDOWS_IN_TAB(win, curtab) { if (bt_help(win->w_buffer)) { - win_close(win, FALSE); + win_close(win, false); return; } } diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index ff625d6dc9..31231fe725 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -6192,7 +6192,7 @@ static int open_cmdwin(void) wp = curwin; set_bufref(&bufref, curbuf); win_goto(old_curwin); - win_close(wp, TRUE); + win_close(wp, true); // win_close() may have already wiped the buffer when 'bh' is // set to 'wipe'. diff --git a/src/nvim/main.c b/src/nvim/main.c index ab8b33aa12..0698a8dc0d 100644 --- a/src/nvim/main.c +++ b/src/nvim/main.c @@ -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()). */ if (curwin->w_arg_idx == -1) { - win_close(curwin, TRUE); + win_close(curwin, true); 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()). if (curwin->w_arg_idx == -1) { ++arg_idx; - win_close(curwin, TRUE); + win_close(curwin, true); advance = FALSE; continue; } @@ -1598,7 +1598,7 @@ static void edit_buffers(mparm_T *parmp, char_u *cwd) did_emsg = FALSE; /* avoid hit-enter prompt */ getout(1); } - win_close(curwin, TRUE); + win_close(curwin, true); advance = FALSE; } if (arg_idx == GARGCOUNT - 1) diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c index fb7440f7da..d719f2e0a1 100644 --- a/src/nvim/quickfix.c +++ b/src/nvim/quickfix.c @@ -2598,7 +2598,7 @@ void ex_cclose(exarg_T *eap) /* Find existing quickfix window and close it. */ win = qf_find_win(qi); if (win != NULL) - win_close(win, FALSE); + win_close(win, false); } /* diff --git a/src/nvim/tag.c b/src/nvim/tag.c index 2a980af2a2..91f182dd50 100644 --- a/src/nvim/tag.c +++ b/src/nvim/tag.c @@ -2612,7 +2612,7 @@ static int jumpto_tag( } else { --RedrawingDisabled; if (postponed_split) { /* close the window */ - win_close(curwin, FALSE); + win_close(curwin, false); postponed_split = 0; } } diff --git a/src/nvim/window.c b/src/nvim/window.c index 04990fedae..02bf10f9a7 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -1859,20 +1859,18 @@ static bool close_last_window_tabpage(win_T *win, bool free_buf, return true; } -/* - * Close window "win". Only works for the current tab page. - * If "free_buf" is TRUE related buffer may be unloaded. - * - * Called by :quit, :close, :xit, :wq and findtag(). - * Returns FAIL when the window was not closed. - */ -int win_close(win_T *win, int free_buf) +// Close window "win". Only works for the current tab page. +// If "free_buf" is true related buffer may be unloaded. +// +// Called by :quit, :close, :xit, :wq and findtag(). +// Returns FAIL when the window was not closed. +int win_close(win_T *win, bool free_buf) { win_T *wp; int other_buffer = FALSE; int close_curwin = FALSE; int dir; - int help_window = FALSE; + bool help_window = false; tabpage_T *prev_curtab = curtab; 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 * the window. Otherwise clear the snapshot, it's now invalid. */ if (bt_help(win->w_buffer)) - help_window = TRUE; + help_window = true; else clear_snapshot(curtab, SNAP_HELP_IDX); |