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

@@ -141,11 +141,7 @@ find_ucmd(
/*
* Look for buffer-local user commands first, then global ones.
*/
gap =
#ifdef FEAT_CMDWIN
is_in_cmdwin() ? &prevwin->w_buffer->b_ucmds :
#endif
&curbuf->b_ucmds;
gap = &prevwin_curwin()->w_buffer->b_ucmds;
for (;;)
{
for (j = 0; j < gap->ga_len; ++j)
@@ -358,11 +354,7 @@ expand_user_command_name(int idx)
get_user_commands(expand_T *xp UNUSED, int idx)
{
// In cmdwin, the alternative buffer should be used.
buf_T *buf =
#ifdef FEAT_CMDWIN
is_in_cmdwin() ? prevwin->w_buffer :
#endif
curbuf;
buf_T *buf = prevwin_curwin()->w_buffer;
if (idx < buf->b_ucmds.ga_len)
return USER_CMD_GA(&buf->b_ucmds, idx)->uc_name;
@@ -386,11 +378,7 @@ get_user_command_name(int idx, int cmdidx)
if (cmdidx == CMD_USER_BUF)
{
// In cmdwin, the alternative buffer should be used.
buf_T *buf =
#ifdef FEAT_CMDWIN
is_in_cmdwin() ? prevwin->w_buffer :
#endif
curbuf;
buf_T *buf = prevwin_curwin()->w_buffer;
if (idx < buf->b_ucmds.ga_len)
return USER_CMD_GA(&buf->b_ucmds, idx)->uc_name;
@@ -478,11 +466,7 @@ uc_list(char_u *name, size_t name_len)
garray_T *gap;
// In cmdwin, the alternative buffer should be used.
gap =
#ifdef FEAT_CMDWIN
is_in_cmdwin() ? &prevwin->w_buffer->b_ucmds :
#endif
&curbuf->b_ucmds;
gap = &prevwin_curwin()->w_buffer->b_ucmds;
for (;;)
{
for (i = 0; i < gap->ga_len; ++i)