aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nvim/arglist.c4
-rw-r--r--src/nvim/autocmd.h4
-rw-r--r--src/nvim/window.c4
-rw-r--r--src/nvim/window.h2
4 files changed, 12 insertions, 2 deletions
diff --git a/src/nvim/arglist.c b/src/nvim/arglist.c
index 541534abf9..064543b430 100644
--- a/src/nvim/arglist.c
+++ b/src/nvim/arglist.c
@@ -851,6 +851,9 @@ static void arg_all_close_unused_windows(arg_all_state_T *aall)
if (aall->had_tab > 0) {
goto_tabpage_tp(first_tabpage, true, true);
}
+
+ // moving tabpages around in an autocommand may cause an endless loop
+ tabpage_move_disallowed++;
while (true) {
win_T *wpnext = NULL;
tabpage_T *tpnext = curtab->tp_next;
@@ -950,6 +953,7 @@ static void arg_all_close_unused_windows(arg_all_state_T *aall)
}
goto_tabpage_tp(tpnext, true, true);
}
+ tabpage_move_disallowed--;
}
/// Open up to "count" windows for the files in the argument list "aall->alist".
diff --git a/src/nvim/autocmd.h b/src/nvim/autocmd.h
index ea8f32feb2..b0a5a13026 100644
--- a/src/nvim/autocmd.h
+++ b/src/nvim/autocmd.h
@@ -28,8 +28,8 @@ EXTERN win_T *last_cursormoved_win INIT( = NULL);
EXTERN pos_T last_cursormoved INIT( = { 0, 0, 0 });
EXTERN bool autocmd_busy INIT( = false); ///< Is apply_autocmds() busy?
-EXTERN int autocmd_no_enter INIT( = false); ///< *Enter autocmds disabled
-EXTERN int autocmd_no_leave INIT( = false); ///< *Leave autocmds disabled
+EXTERN int autocmd_no_enter INIT( = false); ///< Buf/WinEnter autocmds disabled
+EXTERN int autocmd_no_leave INIT( = false); ///< Buf/WinLeave autocmds disabled
EXTERN bool did_filetype INIT( = false); ///< FileType event found
/// value for did_filetype when starting to execute autocommands
EXTERN bool keep_filetype INIT( = false);
diff --git a/src/nvim/window.c b/src/nvim/window.c
index 618a3f760e..0a09d8e27d 100644
--- a/src/nvim/window.c
+++ b/src/nvim/window.c
@@ -4426,6 +4426,10 @@ void tabpage_move(int nr)
return;
}
+ if (tabpage_move_disallowed) {
+ return;
+ }
+
int n = 1;
tabpage_T *tp;
diff --git a/src/nvim/window.h b/src/nvim/window.h
index d70292508a..3c88965324 100644
--- a/src/nvim/window.h
+++ b/src/nvim/window.h
@@ -43,6 +43,8 @@ enum {
LOWEST_WIN_ID = 1000,
};
+EXTERN int tabpage_move_disallowed INIT( = 0); ///< moving tabpages around disallowed
+
/// Set to true if 'cmdheight' was explicitly set to 0.
EXTERN bool p_ch_was_zero INIT( = false);