Problem: Crash when switching tabpage while in the cmdline window.
Solution: Disallow switching tabpage when in the cmdline window.
}
// b: variables
- ht =
-#ifdef FEAT_CMDWIN
- // In cmdwin, the alternative buffer should be used.
- is_in_cmdwin() ? &prevwin->w_buffer->b_vars->dv_hashtab :
-#endif
- &curbuf->b_vars->dv_hashtab;
+ ht = &prevwin_curwin()->w_buffer->b_vars->dv_hashtab;
if (bdone < ht->ht_used)
{
if (bdone++ == 0)
}
// w: variables
- ht =
-#ifdef FEAT_CMDWIN
- // In cmdwin, the alternative window should be used.
- is_in_cmdwin() ? &prevwin->w_vars->dv_hashtab :
-#endif
- &curwin->w_vars->dv_hashtab;
+ ht = &prevwin_curwin()->w_vars->dv_hashtab;
if (wdone < ht->ht_used)
{
if (wdone++ == 0)
/* window.c */
+win_T *prevwin_curwin(void);
void do_window(int nchar, long Prenum, int xchar);
void get_wincmd_addr_type(char_u *arg, exarg_T *eap);
int win_split(int size, int flags);
/*
* 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)
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;
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;
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)
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 4428,
/**/
4427,
/**/
}
#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().
*/
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;
text_locked_msg();
return;
}
+ CHECK_CMDWIN;
// If there is only one it can't work.
if (first_tabpage->tp_next == NULL)
int trigger_enter_autocmds,
int trigger_leave_autocmds)
{
+ CHECK_CMDWIN;
+
// Don't repeat a message in another tab page.
set_keep_msg(NULL, 0);