From 9fcd444036e687a3c5c9aa75fa29b6251b3ad431 Mon Sep 17 00:00:00 2001 From: Marco Hinz Date: Wed, 11 Nov 2015 04:27:50 +0100 Subject: Add TermClose event A terminal buffer now exits with: [Process exited ] You can hook into it. E.g. :au TermClose * call feedkeys('') Closes #2293. --- test/functional/terminal/ex_terminal_spec.lua | 6 +++--- test/functional/terminal/scrollback_spec.lua | 2 +- test/functional/terminal/tui_spec.lua | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'test') diff --git a/test/functional/terminal/ex_terminal_spec.lua b/test/functional/terminal/ex_terminal_spec.lua index 3855cf4b65..611ba55793 100644 --- a/test/functional/terminal/ex_terminal_spec.lua +++ b/test/functional/terminal/ex_terminal_spec.lua @@ -22,7 +22,7 @@ describe(':terminal', function() wait() screen:expect([[ ready $ | - [Program exited, press any key to close] | + [Process exited 0] | | | | @@ -37,7 +37,7 @@ describe(':terminal', function() screen:expect([[ ready $ echo hi | | - [Program exited, press any key to close] | + [Process exited 0] | | | | @@ -51,7 +51,7 @@ describe(':terminal', function() screen:expect([[ ready $ echo 'hello' \ "world" | | - [Program exited, press any key to close] | + [Process exited 0] | | | | diff --git a/test/functional/terminal/scrollback_spec.lua b/test/functional/terminal/scrollback_spec.lua index 87cc9a8266..4b56698520 100644 --- a/test/functional/terminal/scrollback_spec.lua +++ b/test/functional/terminal/scrollback_spec.lua @@ -340,7 +340,7 @@ describe('terminal prints more lines than the screen height and exits', function line8 | line9 | | - [Program exited, press any key to close] | + [Process exited 0] | -- TERMINAL -- | ]]) feed('') diff --git a/test/functional/terminal/tui_spec.lua b/test/functional/terminal/tui_spec.lua index 0c4b80fdd2..ba0c531c7e 100644 --- a/test/functional/terminal/tui_spec.lua +++ b/test/functional/terminal/tui_spec.lua @@ -167,7 +167,7 @@ describe('tui with non-tty file descriptors', function() :q | abc | | - [Program exited, press any key to close] | + [Process exited 0] | | -- TERMINAL -- | ]]) -- cgit From ec847af48d0a12aa177c0f51cfc11be0ebac26e5 Mon Sep 17 00:00:00 2001 From: Marco Hinz Date: Sun, 15 Nov 2015 15:45:23 +0100 Subject: Test: add functional/autocmd/termclose_spec.lua --- test/functional/autocmd/termclose_spec.lua | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 test/functional/autocmd/termclose_spec.lua (limited to 'test') diff --git a/test/functional/autocmd/termclose_spec.lua b/test/functional/autocmd/termclose_spec.lua new file mode 100644 index 0000000000..265d857a42 --- /dev/null +++ b/test/functional/autocmd/termclose_spec.lua @@ -0,0 +1,28 @@ +local helpers = require('test.functional.helpers') +local Screen = require('test.functional.ui.screen') + +local clear, eval, execute, feed, nvim, nvim_dir = helpers.clear, helpers.eval, +helpers.execute, helpers.feed, helpers.nvim, helpers.nvim_dir +local wait = helpers.wait + +describe('TermClose event', function() + before_each(function() + clear() + nvim('set_option', 'shell', nvim_dir .. '/shell-test') + nvim('set_option', 'shellcmdflag', 'EXE') + screen = Screen.new(20, 4) + screen:attach(false) + end) + + it('works as expected', function() + execute('autocmd TermClose * echomsg "TermClose works!"') + execute('terminal') + feed('') + screen:expect([[ + ready $ | + [Process exited 0] | + ^ | + TermClose works! | + ]]) + end) +end) -- cgit