]> granicus.if.org Git - vim/commitdiff
patch 9.0.0064: confusing error when using "q:" in command line window v9.0.0064
authorBram Moolenaar <Bram@vim.org>
Sun, 24 Jul 2022 19:08:01 +0000 (20:08 +0100)
committerBram Moolenaar <Bram@vim.org>
Sun, 24 Jul 2022 19:08:01 +0000 (20:08 +0100)
Problem:    Confusing error when using "q:" in command line window.
Solution:   Check for the situation and give a better error message.
            (closes #10756)

src/errors.h
src/normal.c
src/testdir/test_cmdwin.vim
src/version.c

index 90aa2921a6eb573aa9650724c5a0cb08693d25d0..965187f785d7f33fcdffd00248caadae4e4d6fa8 100644 (file)
@@ -3306,3 +3306,7 @@ EXTERN char e_substitute_nesting_too_deep[]
 EXTERN char e_invalid_argument_nr[]
        INIT(= N_("E1291: Invalid argument: %ld"));
 #endif
+#ifdef FEAT_CMDWIN
+EXTERN char e_cmdline_window_already_open[]
+       INIT(= N_("E1292: Command-line window is already open"));
+#endif
index 72ebcd5386c0c1ed01e90899fad61e0f725f407e..932d72320540b68afa5cf783d80bcd395888e37a 100644 (file)
@@ -7147,6 +7147,11 @@ nv_record(cmdarg_T *cap)
 #ifdef FEAT_CMDWIN
        if (cap->nchar == ':' || cap->nchar == '/' || cap->nchar == '?')
        {
+           if (cmdwin_type != 0)
+           {
+               emsg(_(e_cmdline_window_already_open));
+               return;
+           }
            stuffcharReadbuff(cap->nchar);
            stuffcharReadbuff(K_CMDWIN);
        }
index 45ecdd11c6c1de27419f30ba50b34b76063e6603..d641b292305cb1b2a0a5af0c38260aab2f21c4f7 100644 (file)
@@ -356,5 +356,14 @@ func Test_cmdwin_ctrl_bsl()
   call assert_equal('', getcmdwintype())
 endfunc
 
+func Test_cant_open_cmdwin_in_cmdwin()
+  try
+    call feedkeys("q:q::q\<CR>", "x!")
+  catch
+    let caught = v:exception
+  endtry
+  call assert_match('E1292:', caught)
+endfunc
+
 
 " vim: shiftwidth=2 sts=2 expandtab
index d7d0790a596e06bc2985d63829f8764f72554714..7534c2371577721d5100a9a29f09de50ecbd73bd 100644 (file)
@@ -735,6 +735,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    64,
 /**/
     63,
 /**/