From 3dfbeabf35dbfe5494a4adce7b4d94d56bbe0171 Mon Sep 17 00:00:00 2001 From: Shougo Matsushita Date: Sat, 19 Dec 2015 10:03:17 +0900 Subject: vim-patch:7.4.569/573 vim-patch:7.4.569 vim-patch:7.4.573 Helped-by: @glts https://github.com/neovim/neovim/pull/2621 Problem: Having CTRL-C interrupt or not does not check the mode of the mapping. (Ingo Karkat) Solution: Use a bitmask with the map mode. (Christian Brabandt) https://github.com/vim/vim/commit/651863c94a882a97aec7968fc87a638ff78e56ff Problem: Mapping CTRL-C in Visual mode doesn't work. (Ingo Karkat) Solution: Call get_real_state() instead of using State directly. https://github.com/vim/vim/commit/5000869712f799d9ca25c0e45dc21d332edae5f4 --- test/functional/legacy/mapping_spec.lua | 50 ++++++++++++++++++++++++++++++--- 1 file changed, 46 insertions(+), 4 deletions(-) (limited to 'test/functional/legacy/mapping_spec.lua') diff --git a/test/functional/legacy/mapping_spec.lua b/test/functional/legacy/mapping_spec.lua index 4d377904f9..f0cef3773d 100644 --- a/test/functional/legacy/mapping_spec.lua +++ b/test/functional/legacy/mapping_spec.lua @@ -2,12 +2,12 @@ local helpers = require('test.functional.helpers') local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert -local execute, expect = helpers.execute, helpers.expect +local execute, expect, wait = helpers.execute, helpers.expect, helpers.wait describe('mapping', function() before_each(clear) - it('is working', function() + it('abbreviations with р (0x80)', function() insert([[ test starts here: ]]) @@ -16,6 +16,49 @@ describe('mapping', function() execute('inoreab чкпр vim') feed('GAчкпр ') + expect([[ + test starts here: + vim ]]) + end) + + it('works with Ctrl-c in Insert mode', function() + -- Mapping of ctrl-c in insert mode + execute('set cpo-=< cpo-=k') + execute('inoremap ') + execute('cnoremap dummy') + execute('cunmap ') + feed('GA') + feed('TEST2: CTRL-C |') + wait() + feed('A|') + wait() + execute('unmap ') + execute('unmap! ') + + expect([[ + + TEST2: CTRL-C |A| + ]]) + end) + + it('works with Ctrl-c in Visual mode', function() + -- Mapping of ctrl-c in Visual mode. + execute([[vnoremap :$put ='vmap works']]) + feed('GV') + -- For some reason the mapping is only triggered when is entered in a + -- separate feed command. + wait() + feed('') + wait() + feed('') + execute('vunmap ') + + expect([[ + + vmap works]]) + end) + + it('works with Ctrl-c in Insert mode with langmap', function() -- langmap should not get remapped in insert mode. execute('inoremap { FAIL_ilangmap') execute('set langmap=+{ langnoremap') @@ -37,8 +80,7 @@ describe('mapping', function() -- Assert buffer contents. expect([[ - test starts here: - vim + + + + -- cgit From 8eeda7169aa47881f0b6d697e291a1ef85c43e4e Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Wed, 13 Jan 2016 00:39:54 -0500 Subject: terminal: less babysitting of mapped_ctrl_c process_interrupts() checks get_real_state() so we can avoid some housekeeping of mapped_ctrl_c in terminal-mode. --- test/functional/legacy/mapping_spec.lua | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'test/functional/legacy/mapping_spec.lua') diff --git a/test/functional/legacy/mapping_spec.lua b/test/functional/legacy/mapping_spec.lua index f0cef3773d..3f86ec60de 100644 --- a/test/functional/legacy/mapping_spec.lua +++ b/test/functional/legacy/mapping_spec.lua @@ -21,7 +21,7 @@ describe('mapping', function() vim ]]) end) - it('works with Ctrl-c in Insert mode', function() + it('Ctrl-c works in Insert mode', function() -- Mapping of ctrl-c in insert mode execute('set cpo-=< cpo-=k') execute('inoremap ') @@ -41,16 +41,13 @@ describe('mapping', function() ]]) end) - it('works with Ctrl-c in Visual mode', function() - -- Mapping of ctrl-c in Visual mode. - execute([[vnoremap :$put ='vmap works']]) + it('Ctrl-c works in Visual mode', function() + execute([[vnoremap :$put ='vmap works']]) feed('GV') - -- For some reason the mapping is only triggered when is entered in a - -- separate feed command. + -- XXX: For some reason the mapping is only triggered + -- when is in a separate feed command. wait() feed('') - wait() - feed('') execute('vunmap ') expect([[ @@ -58,7 +55,7 @@ describe('mapping', function() vmap works]]) end) - it('works with Ctrl-c in Insert mode with langmap', function() + it('langmap', function() -- langmap should not get remapped in insert mode. execute('inoremap { FAIL_ilangmap') execute('set langmap=+{ langnoremap') -- cgit