diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2018-10-17 09:51:09 +0200 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2018-10-17 09:51:09 +0200 |
commit | aff64b3a52d3d897c5c88270c8e78ba3d02c52f7 (patch) | |
tree | c49fbfe8219d7e13e702ca881f9b869345e638d7 | |
parent | 9642903dea68c614038b134a3806d31af032fe77 (diff) | |
parent | 9c2d5f1a33ccf3838899425ede481c6cdb00acb5 (diff) | |
download | rneovim-aff64b3a52d3d897c5c88270c8e78ba3d02c52f7.tar.gz rneovim-aff64b3a52d3d897c5c88270c8e78ba3d02c52f7.tar.bz2 rneovim-aff64b3a52d3d897c5c88270c8e78ba3d02c52f7.zip |
Merge #9124 'vim-patch:8.0.1672'
-rw-r--r-- | src/nvim/ex_getln.c | 4 | ||||
-rw-r--r-- | src/nvim/testdir/test_cmdline.vim | 11 | ||||
-rw-r--r-- | test/functional/ui/cmdline_highlight_spec.lua | 17 | ||||
-rw-r--r-- | test/functional/ui/inccommand_spec.lua | 7 |
4 files changed, 29 insertions, 10 deletions
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index 247b9175aa..f40131177e 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -510,6 +510,10 @@ static int command_line_check(VimState *state) // completion may switch it on. quit_more = false; // reset after CTRL-D which had a more-prompt + did_emsg = false; // There can't really be a reason why an error + // that occurs while typing a command should + // cause the command not to be executed. + cursorcmd(); // set the cursor on the right spot ui_cursor_shape(); return 1; diff --git a/src/nvim/testdir/test_cmdline.vim b/src/nvim/testdir/test_cmdline.vim index c302948ba3..26f1dcc333 100644 --- a/src/nvim/testdir/test_cmdline.vim +++ b/src/nvim/testdir/test_cmdline.vim @@ -334,6 +334,17 @@ func Test_paste_in_cmdline() call feedkeys(":\<C-\>etoupper(getline(1))\<CR>\<C-B>\"\<CR>", 'tx') call assert_equal('"ASDF.X /TMP/SOME VERYLONGWORD A;B-C*D ', @:) bwipe! + + " Error while typing a command used to cause that it was not executed + " in the end. + new + try + call feedkeys(":file \<C-R>%Xtestfile\<CR>", 'tx') + catch /^Vim\%((\a\+)\)\=:E32/ + " ignore error E32 + endtry + call assert_equal("Xtestfile", bufname("%")) + bwipe! endfunc func Test_remove_char_in_cmdline() diff --git a/test/functional/ui/cmdline_highlight_spec.lua b/test/functional/ui/cmdline_highlight_spec.lua index 768b24dd81..2eab44dc90 100644 --- a/test/functional/ui/cmdline_highlight_spec.lua +++ b/test/functional/ui/cmdline_highlight_spec.lua @@ -755,7 +755,7 @@ describe('Command-line coloring', function() eq(1, meths.eval('1')) end) end) -describe('Ex commands coloring support', function() +describe('Ex commands coloring', function() it('works', function() meths.set_var('Nvim_color_cmdline', 'RainBowParens') feed(':echo (((1)))') @@ -831,7 +831,7 @@ describe('Ex commands coloring support', function() | ]]) end) - it('does not prevent mapping error from cancelling prompt', function() + it('mapping error does not cancel prompt', function() command("cnoremap <expr> x execute('throw 42')[-1]") feed(':#x') screen:expect([[ @@ -846,16 +846,17 @@ describe('Ex commands coloring support', function() ]]) feed('<CR>') screen:expect([[ - ^ | - {EOB:~ }| - {EOB:~ }| {EOB:~ }| {EOB:~ }| {EOB:~ }| - {EOB:~ }| - | + :# | + {ERR:Error detected while processing :} | + {ERR:E605: Exception not caught: 42} | + {ERR:E749: empty buffer} | + {PE:Press ENTER or type command to continue}^ | ]]) - eq('Error detected while processing :\nE605: Exception not caught: 42', + feed('<CR>') + eq('Error detected while processing :\nE605: Exception not caught: 42\nE749: empty buffer', meths.command_output('messages')) end) it('errors out when failing to get callback', function() diff --git a/test/functional/ui/inccommand_spec.lua b/test/functional/ui/inccommand_spec.lua index 0983f6f399..736a314426 100644 --- a/test/functional/ui/inccommand_spec.lua +++ b/test/functional/ui/inccommand_spec.lua @@ -1539,7 +1539,7 @@ describe("'inccommand' and :cnoremap", function() end end) - it('does not work with a failing mapping', function() + it('still works with a broken mapping', function() for _, case in pairs(cases) do refresh(case) feed_command("cnoremap <expr> x execute('bwipeout!')[-1].'x'") @@ -1548,7 +1548,10 @@ describe("'inccommand' and :cnoremap", function() -- error thrown b/c of the mapping neq(nil, eval('v:errmsg'):find('^E523:')) - expect(default_text) + expect([[ + Inc substitution on + toxo lines + ]]) end end) |