From e596234fc2fa056ef6ac9eb868bdfcdceba4af47 Mon Sep 17 00:00:00 2001 From: Thiago de Arruda Date: Fri, 2 Oct 2015 10:59:06 -0300 Subject: test: Add more TUI tests and increase timeout --- test/functional/terminal/tui_spec.lua | 47 ++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) (limited to 'test/functional') diff --git a/test/functional/terminal/tui_spec.lua b/test/functional/terminal/tui_spec.lua index 5ec087645f..d38bedcd4a 100644 --- a/test/functional/terminal/tui_spec.lua +++ b/test/functional/terminal/tui_spec.lua @@ -12,7 +12,9 @@ describe('tui', function() before_each(function() helpers.clear() screen = thelpers.screen_setup(0, '["'..helpers.nvim_prog..'", "-u", "NONE", "-i", "NONE", "--cmd", "set noswapfile"]') - screen.timeout = 30000 -- pasting can be really slow in the TUI + -- right now pasting can be really slow in the TUI, especially in ASAN. + -- this will be fixed later but for now we require a high timeout. + screen.timeout = 60000 screen:expect([[ {1: } | ~ | @@ -51,6 +53,49 @@ describe('tui', function() ]]) end) + it('interprets leading esc byte as the alt modifier', function() + local keys = 'dfghjkl' + for c in keys:gmatch('.') do + execute('nnoremap ialt-'..c..'') + feed('\x1b'..c) + end + screen:expect([[ + alt-j | + alt-k | + alt-l | + {1: } | + [No Name] [+] | + | + -- TERMINAL -- | + ]]) + feed('gg') + screen:expect([[ + {1:a}lt-d | + alt-f | + alt-g | + alt-h | + [No Name] [+] | + | + -- TERMINAL -- | + ]]) + end) + + it('accepts ascii control sequences', function() + feed('i') + feed('\x16\x07') -- ctrl+g + feed('\x16\x16') -- ctrl+v + feed('\x16\x0d') -- ctrl+m + screen:expect([[ + {3:^G^V^M}{1: } | + ~ | + ~ | + ~ | + [No Name] [+] | + -- INSERT -- | + -- TERMINAL -- | + ]], {[1] = {reverse = true}, [2] = {background = 11}, [3] = {foreground = 4}}) + end) + it('automatically sends for bracketed paste sequences', function() feed('i\x1b[200~') screen:expect([[ -- cgit From e5165bae1139221ef752bccd582c7bd7474e6747 Mon Sep 17 00:00:00 2001 From: Thiago de Arruda Date: Mon, 5 Oct 2015 10:13:18 -0300 Subject: input: Remove CURSORHOLD key Refactor input.c, normal.c and edit.c to use the K_EVENT special key to trigger the CURSORHOLD event. In normal and edit mode, K_EVENT is treated as K_CURSORHOLD, which enables better handling of arbitrary actions in those states(eg: In normal mode the previous operator counts will be restored). Also fix a test in vim_spec.lua. The test had a wrong assumption: cmdheight is only used to determine when the press enter screen will be shown, not to limit how many lines or control pagination. --- test/functional/api/vim_spec.lua | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) (limited to 'test/functional') diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua index 8d4e183653..eb4804f141 100644 --- a/test/functional/api/vim_spec.lua +++ b/test/functional/api/vim_spec.lua @@ -247,33 +247,21 @@ describe('vim_* functions', function() ~ | {1:very fail} | ]]) + helpers.wait() -- shows up to &cmdheight lines - nvim_async('err_write', 'more fail\n') - nvim_async('err_write', 'too fail\n') + nvim_async('err_write', 'more fail\ntoo fail\n') screen:expect([[ ~ | ~ | ~ | ~ | ~ | - {1:very fail} | - {1:more fail} | - {2:Press ENTER or type command to continue}^ | - ]]) - - -- shows the rest after return - feed('') - screen:expect([[ - ~ | - ~ | - ~ | - {1:very fail} | {1:more fail} | - {2:Press ENTER or type command to continue} | {1:too fail} | {2:Press ENTER or type command to continue}^ | ]]) + feed('') -- exit the press ENTER screen end) end) -- cgit