From 01570f1ff3c402af9a9a48c2cca2c5a830c08315 Mon Sep 17 00:00:00 2001 From: Marco Hinz Date: Thu, 12 Jul 2018 14:57:20 +0200 Subject: terminal: handle &confirm and :confirm on unloading (#8726) Show a proper confirmation dialog when trying to unload a terminal buffer while the confirm option is set or when :confirm is used. Fixes https://github.com/neovim/neovim/issues/4651 --- test/functional/terminal/buffer_spec.lua | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'test') diff --git a/test/functional/terminal/buffer_spec.lua b/test/functional/terminal/buffer_spec.lua index 4ce33fef7b..c290031fbe 100644 --- a/test/functional/terminal/buffer_spec.lua +++ b/test/functional/terminal/buffer_spec.lua @@ -201,6 +201,28 @@ describe('terminal buffer', function() feed([[]]) feed_command('bdelete!') end) + + describe('handles confirmations', function() + it('with :confirm', function() + feed_command('terminal') + feed('') + feed_command('confirm bdelete') + screen:expect('Close "term://', nil, true, nil, true) + end) + + it('with &confirm', function() + feed_command('terminal') + feed('') + feed_command('bdelete') + screen:expect('E89', nil, true, nil, true) + feed('') + eq('terminal', eval('&buftype')) + feed_command('set confirm | bdelete') + screen:expect('Close "term://', nil, true, nil, true) + feed('y') + neq('terminal', eval('&buftype')) + end) + end) end) describe('No heap-buffer-overflow when using', function() -- cgit