From 224ebc0078f29ac3189d7fbd9a59b386ae2ee303 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Wed, 4 Apr 2018 01:08:07 +0200 Subject: insert-mode: interpret unmapped META as ESC closes #2454 closes #8213 ref #7972 --- test/functional/insert/insert_spec.lua | 41 ++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 test/functional/insert/insert_spec.lua (limited to 'test/functional/insert/insert_spec.lua') diff --git a/test/functional/insert/insert_spec.lua b/test/functional/insert/insert_spec.lua new file mode 100644 index 0000000000..427954f5a6 --- /dev/null +++ b/test/functional/insert/insert_spec.lua @@ -0,0 +1,41 @@ +local helpers = require('test.functional.helpers')(after_each) +local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert +local command = helpers.command +local eq = helpers.eq +local expect = helpers.expect +local funcs = helpers.funcs + +describe('insert-mode', function() + before_each(function() + clear() + end) + + it('CTRL-@', function() + -- Inserts last-inserted text, leaves insert-mode. + insert('hello') + feed('ix') + expect('hellhello') + + -- C-Space is the same as C-@. + -- CTRL-SPC inserts last-inserted text, leaves insert-mode. + feed('ix') + expect('hellhellhello') + + -- CTRL-A inserts last inserted text + feed('ix') + expect('hellhellhellhelloxo') + end) + + it('ALT/META #8213', function() + -- Mapped ALT-chord behaves as mapped. + command('inoremap meta-l') + command('inoremap alt-j') + feed('i xxx a') + expect('meta-l xxx alt-j') + eq({ 0, 1, 14, 0, }, funcs.getpos('.')) + -- Unmapped ALT-chord behaves as ESC+c. + command('iunmap ') + feed('0i') + eq({ 0, 1, 2, 0, }, funcs.getpos('.')) + end) +end) -- cgit