Merge #9124 'vim-patch:8.0.1672'

This commit is contained in:
Justin M. Keyes 2018-10-17 09:51:09 +02:00
commit aff64b3a52
4 changed files with 29 additions and 10 deletions

View File

@ -510,6 +510,10 @@ static int command_line_check(VimState *state)
// completion may switch it on. // completion may switch it on.
quit_more = false; // reset after CTRL-D which had a more-prompt 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 cursorcmd(); // set the cursor on the right spot
ui_cursor_shape(); ui_cursor_shape();
return 1; return 1;

View File

@ -334,6 +334,17 @@ func Test_paste_in_cmdline()
call feedkeys(":\<C-\>etoupper(getline(1))\<CR>\<C-B>\"\<CR>", 'tx') call feedkeys(":\<C-\>etoupper(getline(1))\<CR>\<C-B>\"\<CR>", 'tx')
call assert_equal('"ASDF.X /TMP/SOME VERYLONGWORD A;B-C*D ', @:) call assert_equal('"ASDF.X /TMP/SOME VERYLONGWORD A;B-C*D ', @:)
bwipe! 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 endfunc
func Test_remove_char_in_cmdline() func Test_remove_char_in_cmdline()

View File

@ -755,7 +755,7 @@ describe('Command-line coloring', function()
eq(1, meths.eval('1')) eq(1, meths.eval('1'))
end) end)
end) end)
describe('Ex commands coloring support', function() describe('Ex commands coloring', function()
it('works', function() it('works', function()
meths.set_var('Nvim_color_cmdline', 'RainBowParens') meths.set_var('Nvim_color_cmdline', 'RainBowParens')
feed(':echo (((1)))') feed(':echo (((1)))')
@ -831,7 +831,7 @@ describe('Ex commands coloring support', function()
| |
]]) ]])
end) 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]") command("cnoremap <expr> x execute('throw 42')[-1]")
feed(':#x') feed(':#x')
screen:expect([[ screen:expect([[
@ -846,16 +846,17 @@ describe('Ex commands coloring support', function()
]]) ]])
feed('<CR>') feed('<CR>')
screen:expect([[ screen:expect([[
^ |
{EOB:~ }| {EOB:~ }|
{EOB:~ }| {EOB:~ }|
{EOB:~ }| {EOB:~ }|
{EOB:~ }| :# |
{EOB:~ }| {ERR:Error detected while processing :} |
{EOB:~ }| {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')) meths.command_output('messages'))
end) end)
it('errors out when failing to get callback', function() it('errors out when failing to get callback', function()

View File

@ -1539,7 +1539,7 @@ describe("'inccommand' and :cnoremap", function()
end end
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 for _, case in pairs(cases) do
refresh(case) refresh(case)
feed_command("cnoremap <expr> x execute('bwipeout!')[-1].'x'") 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 -- error thrown b/c of the mapping
neq(nil, eval('v:errmsg'):find('^E523:')) neq(nil, eval('v:errmsg'):find('^E523:'))
expect(default_text) expect([[
Inc substitution on
toxo lines
]])
end end
end) end)