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
This commit is contained in:
Marco Hinz
2018-07-12 14:57:20 +02:00
committed by GitHub
parent 56065bbdc6
commit 01570f1ff3
3 changed files with 48 additions and 3 deletions

View File

@@ -201,6 +201,28 @@ describe('terminal buffer', function()
feed([[<C-\><C-n>]])
feed_command('bdelete!')
end)
describe('handles confirmations', function()
it('with :confirm', function()
feed_command('terminal')
feed('<c-\\><c-n>')
feed_command('confirm bdelete')
screen:expect('Close "term://', nil, true, nil, true)
end)
it('with &confirm', function()
feed_command('terminal')
feed('<c-\\><c-n>')
feed_command('bdelete')
screen:expect('E89', nil, true, nil, true)
feed('<cr>')
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()