aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ex_docmd.c
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2017-04-26 15:28:10 +0200
committerBjörn Linse <bjorn.linse@gmail.com>2019-03-02 16:29:50 +0100
commit9a1675b065394734ddaef91a314896028e2b1d46 (patch)
treea8e869da9a89592dd69a806c19dbeacef84f9bf4 /src/nvim/ex_docmd.c
parent018e0d5a19c3f710f41a78bcbb0c6e3e393a5ed8 (diff)
downloadrneovim-9a1675b065394734ddaef91a314896028e2b1d46.tar.gz
rneovim-9a1675b065394734ddaef91a314896028e2b1d46.tar.bz2
rneovim-9a1675b065394734ddaef91a314896028e2b1d46.zip
floats: implement floating windows
Co-Author: Dongdong Zhou <dzhou121@gmail.com>
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 cda80dad39..c60ccabf4c 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -6285,6 +6285,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);
}
@@ -6309,8 +6312,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
@@ -6331,6 +6334,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;) {
@@ -6339,6 +6343,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);