aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ex_docmd.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/ex_docmd.c')
-rw-r--r--src/nvim/ex_docmd.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index bbec977c74..8f9af1c2ec 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -6279,6 +6279,9 @@ void tabpage_close(int forceit)
{
// First close all the windows but the current one. If that worked then
// close the last window in this tab, that will close it.
+ while (curwin->w_floating) {
+ ex_win_close(forceit, curwin, NULL);
+ }
if (!ONE_WINDOW) {
close_others(true, forceit);
}
@@ -6303,8 +6306,8 @@ void tabpage_close_other(tabpage_T *tp, int forceit)
/* Limit to 1000 windows, autocommands may add a window while we close
* one. OK, so I'm paranoid... */
while (++done < 1000) {
- sprintf((char *)prev_idx, "%i", tabpage_index(tp));
- wp = tp->tp_firstwin;
+ snprintf((char *)prev_idx, sizeof(prev_idx), "%i", tabpage_index(tp));
+ wp = tp->tp_lastwin;
ex_win_close(forceit, wp, tp);
/* Autocommands may delete the tab page under our fingers and we may
@@ -6325,6 +6328,7 @@ static void ex_only(exarg_T *eap)
{
win_T *wp;
int wnr;
+
if (eap->addr_count > 0) {
wnr = eap->line2;
for (wp = firstwin; --wnr > 0;) {
@@ -6333,6 +6337,10 @@ static void ex_only(exarg_T *eap)
else
wp = wp->w_next;
}
+ } else {
+ wp = curwin;
+ }
+ if (wp != curwin) {
win_goto(wp);
}
close_others(TRUE, eap->forceit);