summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-01-26 21:35:08 +0100
committerBram Moolenaar <Bram@vim.org>2021-01-26 21:35:08 +0100
commitbb4b93ed85726c3921596ca267f531c8c94d819a (patch)
tree6051a56c41cb1482ff005812e6f07187193be6cf
parentce0370d9e67df80c62ff033aa8ca2dbe86841de9 (diff)
downloadvim-git-bb4b93ed85726c3921596ca267f531c8c94d819a.tar.gz
patch 8.2.2413: crash when using :all while using a cmdline windowv8.2.2413
Problem: Crash when using :all while using a cmdline window. (Zdenek Dohnal) Solution: Disallow :all from the cmdline window.
-rw-r--r--src/arglist.c7
-rw-r--r--src/ex_getln.c4
-rw-r--r--src/testdir/test_arglist.vim8
-rw-r--r--src/version.c2
4 files changed, 20 insertions, 1 deletions
diff --git a/src/arglist.c b/src/arglist.c
index 4e971fd4b..06d94280b 100644
--- a/src/arglist.c
+++ b/src/arglist.c
@@ -884,6 +884,13 @@ do_arg_all(
win_T *new_curwin = NULL;
tabpage_T *new_curtab = NULL;
+#ifdef FEAT_CMDWIN
+ if (cmdwin_type != 0)
+ {
+ emsg(_(e_cmdwin));
+ return;
+ }
+#endif
if (ARGCOUNT <= 0)
{
// Don't give an error message. We don't want it when the ":all"
diff --git a/src/ex_getln.c b/src/ex_getln.c
index a3e1f4995..543001476 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -4205,6 +4205,9 @@ open_cmdwin(void)
// Don't let quitting the More prompt make this fail.
got_int = FALSE;
+ // Set "cmdwin_type" before any autocommands may mess things up.
+ cmdwin_type = get_cmdline_type();
+
// Create the command-line buffer empty.
if (do_ecmd(0, NULL, NULL, NULL, ECMD_ONE, ECMD_HIDE, NULL) == FAIL)
{
@@ -4213,7 +4216,6 @@ open_cmdwin(void)
ga_clear(&winsizes);
return Ctrl_C;
}
- cmdwin_type = get_cmdline_type();
apply_autocmds(EVENT_BUFFILEPRE, NULL, NULL, FALSE, curbuf);
(void)setfname(curbuf, (char_u *)"[Command Line]", NULL, TRUE);
diff --git a/src/testdir/test_arglist.vim b/src/testdir/test_arglist.vim
index d6c369f0b..b72fe2d53 100644
--- a/src/testdir/test_arglist.vim
+++ b/src/testdir/test_arglist.vim
@@ -559,4 +559,12 @@ func Test_quit_with_arglist()
call delete('.c.swp')
endfunc
+" Test for ":all" not working when in the cmdline window
+func Test_all_not_allowed_from_cmdwin()
+ au BufEnter * all
+ next x
+ call assert_fails(":norm 7q?x\<CR>", 'E11:')
+ au! BufEnter
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/version.c b/src/version.c
index 9a6763338..c95b106bb 100644
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 2413,
+/**/
2412,
/**/
2411,