aboutsummaryrefslogtreecommitdiff
path: root/test/functional/visual/meta_key_spec.lua
diff options
context:
space:
mode:
authorMatt Wozniski <godlygeek@gmail.com>2020-10-04 02:37:45 -0400
committerMatt Wozniski <godlygeek@gmail.com>2020-10-05 15:27:04 -0400
commit2f06413dfb3624381f112b7d8661fde659c279e7 (patch)
tree59279a7d604e0eae8651dc140d1431e863a9d1a3 /test/functional/visual/meta_key_spec.lua
parentf6ac375604238c94d3dc3eeb9b82e67417460806 (diff)
downloadrneovim-2f06413dfb3624381f112b7d8661fde659c279e7.tar.gz
rneovim-2f06413dfb3624381f112b7d8661fde659c279e7.tar.bz2
rneovim-2f06413dfb3624381f112b7d8661fde659c279e7.zip
Treat unmapped ALT/META as ESC+c in all modes
In #8226 <A-x> and <M-x> were changed to behave like <Esc>x in insert mode when no mapping exists. This commit backs out that change and replaces it with a more general one that makes unmapped ALT and META keypresses as <Esc>+char in all modes. This fixes an unnecessary and confusing inconsistency between modes.
Diffstat (limited to 'test/functional/visual/meta_key_spec.lua')
-rw-r--r--test/functional/visual/meta_key_spec.lua22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/functional/visual/meta_key_spec.lua b/test/functional/visual/meta_key_spec.lua
new file mode 100644
index 0000000000..11f7203da0
--- /dev/null
+++ b/test/functional/visual/meta_key_spec.lua
@@ -0,0 +1,22 @@
+local helpers = require('test.functional.helpers')(after_each)
+local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
+local command = helpers.command
+local expect = helpers.expect
+
+describe('meta-keys-in-visual-mode', function()
+ before_each(function()
+ clear()
+ end)
+
+ it('ALT/META', function()
+ -- Unmapped ALT-chords behave as Esc+c
+ insert('peaches')
+ feed('viw<A-x>viw<M-x>')
+ expect('peach')
+ -- Mapped ALT-chord behaves as mapped.
+ command('vnoremap <M-l> Ameta-l<Esc>')
+ command('vnoremap <A-j> Aalt-j<Esc>')
+ feed('viw<A-j>viw<M-l>')
+ expect('peachalt-jmeta-l')
+ end)
+end)