Skip to content

Commit

Permalink
patch 9.0.0064: confusing error when using "q:" in command line window
Browse files Browse the repository at this point in the history
Problem:    Confusing error when using "q:" in command line window.
Solution:   Check for the situation and give a better error message.
            (closes #10756)
  • Loading branch information
brammool committed Jul 24, 2022
1 parent d61efa5 commit c963ec3
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/errors.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 5 additions & 0 deletions src/normal.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
9 changes: 9 additions & 0 deletions src/testdir/test_cmdwin.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions src/version.c
Original file line number Diff line number Diff line change
Expand Up @@ -735,6 +735,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
64,
/**/
63,
/**/
Expand Down

0 comments on commit c963ec3

Please sign in to comment.