This commit is contained in:
Jan Edmund Lazo
2018-09-05 23:04:54 -04:00
parent c0d26ba4f9
commit 2be853d486
5 changed files with 23 additions and 18 deletions

View File

@@ -841,7 +841,7 @@ void goto_buffer(exarg_T *eap, int start, int dir, int count)
* aborting() returns FALSE when closing a window. */ * aborting() returns FALSE when closing a window. */
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;
@@ -4652,9 +4652,9 @@ void ex_buffer_all(exarg_T *eap)
&& !(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...
open_wins = 0; open_wins = 0;
} else } else
++open_wins; ++open_wins;
@@ -4723,9 +4723,9 @@ void ex_buffer_all(exarg_T *eap)
* aborting() returns FALSE when closing a window. */ * aborting() returns FALSE when closing a window. */
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

@@ -1562,7 +1562,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;

View File

@@ -1140,7 +1140,7 @@ qf_init_ext(
} }
if (state.fd == NULL || !ferror(state.fd)) { if (state.fd == NULL || !ferror(state.fd)) {
if (qfl->qf_index == 0) { if (qfl->qf_index == 0) {
/* no valid entry found */ // no valid entry found
qfl->qf_ptr = qfl->qf_start; qfl->qf_ptr = qfl->qf_start;
qfl->qf_index = 1; qfl->qf_index = 1;
qfl->qf_nonevalid = true; qfl->qf_nonevalid = true;
@@ -1150,7 +1150,7 @@ qf_init_ext(
qfl->qf_ptr = qfl->qf_start; qfl->qf_ptr = qfl->qf_start;
} }
} }
/* return number of matches */ // return number of matches
retval = qfl->qf_count; retval = qfl->qf_count;
goto qf_init_end; goto qf_init_end;
} }
@@ -2597,9 +2597,10 @@ 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);
} }
}
/* /*
* ":copen": open a window that shows the list of errors. * ":copen": open a window that shows the list of errors.
@@ -4862,10 +4863,12 @@ void ex_helpgrep(exarg_T *eap)
/* If the help window is not opened or if it already points to the /* If the help window is not opened or if it already points to the
* correct location list, then free the new location list. */ * correct location list, then free the new location list. */
if (!bt_help(curwin->w_buffer) || curwin->w_llist == qi) { if (!bt_help(curwin->w_buffer) || curwin->w_llist == qi) {
if (new_qi) if (new_qi) {
ll_free_all(&qi); ll_free_all(&qi);
} else if (curwin->w_llist == NULL) }
} else if (curwin->w_llist == NULL) {
curwin->w_llist = qi; curwin->w_llist = qi;
} }
} }
}

View File

@@ -2608,10 +2608,10 @@ static int jumpto_tag(
win_enter(curwin_save, true); win_enter(curwin_save, true);
} }
--RedrawingDisabled; RedrawingDisabled--;
} 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

@@ -1900,10 +1900,11 @@ int win_close(win_T *win, bool 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);
}
if (win == curwin) { if (win == curwin) {
/* /*
@@ -1967,8 +1968,9 @@ int win_close(win_T *win, bool free_buf)
|| close_last_window_tabpage(win, free_buf, prev_curtab))) { || close_last_window_tabpage(win, free_buf, prev_curtab))) {
// Autocommands have closed all windows, quit now. Restore // Autocommands have closed all windows, quit now. Restore
// curwin->w_buffer, otherwise writing ShaDa file may fail. // curwin->w_buffer, otherwise writing ShaDa file may fail.
if (curwin->w_buffer == NULL) if (curwin->w_buffer == NULL) {
curwin->w_buffer = curbuf; curwin->w_buffer = curbuf;
}
getout(0); getout(0);
} }
// Autocommands may have moved to another tab page. // Autocommands may have moved to another tab page.