Skip to content

Commit c963ec3

Browse files
committed
patch 9.0.0064: confusing error when using "q:" in command line window
Problem: Confusing error when using "q:" in command line window. Solution: Check for the situation and give a better error message. (closes #10756)
1 parent d61efa5 commit c963ec3

File tree

4 files changed

+20
-0
lines changed

4 files changed

+20
-0
lines changed

src/errors.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3306,3 +3306,7 @@ EXTERN char e_substitute_nesting_too_deep[]
33063306
EXTERN char e_invalid_argument_nr[]
33073307
INIT(= N_("E1291: Invalid argument: %ld"));
33083308
#endif
3309+
#ifdef FEAT_CMDWIN
3310+
EXTERN char e_cmdline_window_already_open[]
3311+
INIT(= N_("E1292: Command-line window is already open"));
3312+
#endif

src/normal.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7147,6 +7147,11 @@ nv_record(cmdarg_T *cap)
71477147
#ifdef FEAT_CMDWIN
71487148
if (cap->nchar == ':' || cap->nchar == '/' || cap->nchar == '?')
71497149
{
7150+
if (cmdwin_type != 0)
7151+
{
7152+
emsg(_(e_cmdline_window_already_open));
7153+
return;
7154+
}
71507155
stuffcharReadbuff(cap->nchar);
71517156
stuffcharReadbuff(K_CMDWIN);
71527157
}

src/testdir/test_cmdwin.vim

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,5 +356,14 @@ func Test_cmdwin_ctrl_bsl()
356356
call assert_equal('', getcmdwintype())
357357
endfunc
358358

359+
func Test_cant_open_cmdwin_in_cmdwin()
360+
try
361+
call feedkeys("q:q::q\<CR>", "x!")
362+
catch
363+
let caught = v:exception
364+
endtry
365+
call assert_match('E1292:', caught)
366+
endfunc
367+
359368

360369
" vim: shiftwidth=2 sts=2 expandtab

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -735,6 +735,8 @@ static char *(features[]) =
735735

736736
static int included_patches[] =
737737
{ /* Add new patch number below this line */
738+
/**/
739+
64,
738740
/**/
739741
63,
740742
/**/

0 commit comments

Comments
 (0)