Mercurial > vim
diff src/window.c @ 27805:afbe86e8b24a v8.2.4428
patch 8.2.4428: crash when switching tabpage while in the cmdline window
Commit: https://github.com/vim/vim/commit/0f6e28f686dbb59ab3b562408ab9b2234797b9b1
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Feb 20 20:49:35 2022 +0000
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.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 20 Feb 2022 22:00:03 +0100 |
parents | c1d1639b52dd |
children | 126826449b54 |
line wrap: on
line diff
--- a/src/window.c +++ b/src/window.c @@ -111,6 +111,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(). */ void @@ -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);