From b8ae09b3cf990c9a374a46c644abe0191e09f2f8 Mon Sep 17 00:00:00 2001 From: Scott Prager Date: Sun, 5 Apr 2015 13:20:08 -0400 Subject: term: after , resume normal input loop Pressing and then a mouse click will insert the click into the terminal as if a keyboard button had been pressed. Keep track of whether the last input was and only call terminal_send_key() if the next input is a key press. --- test/functional/terminal/buffer_spec.lua | 7 +++++-- test/functional/terminal/mouse_spec.lua | 14 ++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) (limited to 'test/functional') diff --git a/test/functional/terminal/buffer_spec.lua b/test/functional/terminal/buffer_spec.lua index 0756508a4c..ffdfec4428 100644 --- a/test/functional/terminal/buffer_spec.lua +++ b/test/functional/terminal/buffer_spec.lua @@ -170,15 +170,18 @@ describe('terminal buffer', function() source([[ function! SplitWindow() new + call feedkeys("iabc\") endfunction startinsert call jobstart(['sh', '-c', 'exit'], {'on_exit': function("SplitWindow")}) + call feedkeys("\", 't') " vim will expect , but be exited out of + " the terminal before it can be entered. ]]) -- We should be in a new buffer now. screen:expect([[ - ^ | + ab^c | ~ | ========== | rows: 2, cols: 50 | @@ -188,7 +191,7 @@ describe('terminal buffer', function() ]]) neq(tbuf, eval('bufnr("%")')) - execute('quit') -- Should exit the new window, not the terminal. + execute('quit!') -- Should exit the new window, not the terminal. eq(tbuf, eval('bufnr("%")')) execute('set laststatus=1') -- Restore laststatus to the default. diff --git a/test/functional/terminal/mouse_spec.lua b/test/functional/terminal/mouse_spec.lua index b8f6214f8f..4def4dd7f8 100644 --- a/test/functional/terminal/mouse_spec.lua +++ b/test/functional/terminal/mouse_spec.lua @@ -50,6 +50,20 @@ describe('terminal mouse', function() ]]) end) + it('will exit focus after , then scrolled', function() + feed('') + feed('<0,0>') + screen:expect([[ + line23 | + line24 | + line25 | + line26 | + line27 | + ^line28 | + | + ]]) + end) + describe('with mouse events enabled by the program', function() before_each(function() thelpers.enable_mouse() -- cgit