diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-05-13 22:23:02 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2023-05-13 22:45:57 +0800 |
commit | c8dc34795b552ac69183e803bfff474ba4e595b6 (patch) | |
tree | e9da399d87433a9f72ce367e5d4ab3155d49828b | |
parent | 6f29c68928c3f20d9a1b1a7a311cfac65aa1b4e6 (diff) | |
download | rneovim-c8dc34795b552ac69183e803bfff474ba4e595b6.tar.gz rneovim-c8dc34795b552ac69183e803bfff474ba4e595b6.tar.bz2 rneovim-c8dc34795b552ac69183e803bfff474ba4e595b6.zip |
vim-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 vim/vim#10756)
https://github.com/vim/vim/commit/c963ec31a0c293d629e40cb082d4bfb1651def49
Co-authored-by: Bram Moolenaar <Bram@vim.org>
-rw-r--r-- | src/nvim/normal.c | 6 | ||||
-rw-r--r-- | test/old/testdir/test_cmdwin.vim | 17 |
2 files changed, 23 insertions, 0 deletions
diff --git a/src/nvim/normal.c b/src/nvim/normal.c index 7e44e55a8e..c3fdb304a3 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -107,6 +107,8 @@ static int VIsual_mode_orig = NUL; // saved Visual mode #endif static const char e_changelist_is_empty[] = N_("E664: Changelist is empty"); +static const char e_cmdline_window_already_open[] + = N_("E1292: Command-line window is already open"); static inline void normal_state_init(NormalState *s) { @@ -6372,6 +6374,10 @@ static void nv_record(cmdarg_T *cap) } if (cap->nchar == ':' || cap->nchar == '/' || cap->nchar == '?') { + if (cmdwin_type != 0) { + emsg(_(e_cmdline_window_already_open)); + return; + } stuffcharReadbuff(cap->nchar); stuffcharReadbuff(K_CMDWIN); } else { diff --git a/test/old/testdir/test_cmdwin.vim b/test/old/testdir/test_cmdwin.vim new file mode 100644 index 0000000000..ef334c774f --- /dev/null +++ b/test/old/testdir/test_cmdwin.vim @@ -0,0 +1,17 @@ +" Tests for editing the command line. + +source check.vim +source screendump.vim + + +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 |