0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 8.2.4428: crash when switching tabpage while in the cmdline window

Problem:    Crash when switching tabpage while in the cmdline window.
Solution:   Disallow switching tabpage when in the cmdline window.
This commit is contained in:
Bram Moolenaar
2022-02-20 20:49:35 +00:00
parent 944697ae19
commit 0f6e28f686
5 changed files with 35 additions and 32 deletions

View File

@@ -110,6 +110,21 @@ log_frame_layout(frame_T *frame)
}
#endif
/*
* Return the current window, unless in the cmdline window and "prevwin" is
* set, then return "prevwin".
*/
win_T *
prevwin_curwin(void)
{
return
#ifdef FEAT_CMDWIN
// In cmdwin, the alternative buffer should be used.
is_in_cmdwin() && prevwin != NULL ? prevwin :
#endif
curwin;
}
/*
* All CTRL-W window commands are handled here, called from normal_cmd().
*/
@@ -3927,6 +3942,14 @@ win_new_tabpage(int after)
tabpage_T *newtp;
int n;
#ifdef FEAT_CMDWIN
if (cmdwin_type != 0)
{
emsg(_(e_invalid_in_cmdline_window));
return FAIL;
}
#endif
newtp = alloc_tabpage();
if (newtp == NULL)
return FAIL;
@@ -4301,6 +4324,7 @@ goto_tabpage(int n)
text_locked_msg();
return;
}
CHECK_CMDWIN;
// If there is only one it can't work.
if (first_tabpage->tp_next == NULL)
@@ -4368,6 +4392,8 @@ goto_tabpage_tp(
int trigger_enter_autocmds,
int trigger_leave_autocmds)
{
CHECK_CMDWIN;
// Don't repeat a message in another tab page.
set_keep_msg(NULL, 0);