Mercurial > vim
changeset 29444:44bb4a607125 v9.0.0064
patch 9.0.0064: confusing error when using "q:" in command line window
Commit: https://github.com/vim/vim/commit/c963ec31a0c293d629e40cb082d4bfb1651def49
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jul 24 20:08:01 2022 +0100
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)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 24 Jul 2022 21:15:06 +0200 |
parents | f3e66922db6e |
children | 84a8c41c9d12 |
files | src/errors.h src/normal.c src/testdir/test_cmdwin.vim src/version.c |
diffstat | 4 files changed, 20 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/errors.h +++ b/src/errors.h @@ -3306,3 +3306,7 @@ EXTERN char e_substitute_nesting_too_dee 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
--- a/src/normal.c +++ b/src/normal.c @@ -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); }
--- a/src/testdir/test_cmdwin.vim +++ b/src/testdir/test_cmdwin.vim @@ -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