From 0f00f31cbd9b13b41a0d3d976d192bbbeac9cbe8 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sat, 1 Dec 2018 02:41:31 +0100 Subject: VimL/confirm(): Show dialog even if :silent closes #8788 related #9034 --- test/functional/eval/input_spec.lua | 42 +++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'test/functional/eval/input_spec.lua') diff --git a/test/functional/eval/input_spec.lua b/test/functional/eval/input_spec.lua index 8c65297ac6..e774b939f7 100644 --- a/test/functional/eval/input_spec.lua +++ b/test/functional/eval/input_spec.lua @@ -8,6 +8,7 @@ local clear = helpers.clear local source = helpers.source local command = helpers.command local exc_exec = helpers.exc_exec +local nvim_async = helpers.nvim_async local screen @@ -59,6 +60,7 @@ before_each(function() RBP3={background=Screen.colors.Green}, RBP4={background=Screen.colors.Blue}, SEP={bold = true, reverse = true}, + CONFIRM={bold = true, foreground = Screen.colors.SeaGreen4}, }) end) @@ -439,3 +441,43 @@ describe('inputdialog()', function() ]]) end) end) + +describe('confirm()', function() + it("shows dialog even if :silent #8788", function() + command("autocmd BufNewFile * call confirm('test')") + + local function check_and_clear(edit_line) + screen:expect([[ + | + {SEP: }| + ]]..edit_line..[[ + {CONFIRM:test} | + {CONFIRM:[O]k: }^ | + ]]) + feed('') + command('redraw') + command('bdelete!') + end + + -- With shortmess-=F + command('set shortmess-=F') + feed(':edit foo') + check_and_clear('"foo" [New File] |\n') + + -- With shortmess+=F + command('set shortmess+=F') + feed(':edit foo') + check_and_clear(':edit foo |\n') + + -- With :silent + feed(':silent edit foo') + check_and_clear(':silent edit foo |\n') + + -- With API (via eval/VimL) call and shortmess+=F + feed(':call nvim_command("edit x")') + check_and_clear(':call nvim_command("edit |\n') + + nvim_async('command', 'edit x') + check_and_clear(' |\n') + end) +end) -- cgit