Skip to content

Commit

Permalink
Merge pull request #18918 from neovim/backport-18917-to-release-0.7
Browse files Browse the repository at this point in the history
[Backport release-0.7] fix(input): fix macro recording with ALT and special key
  • Loading branch information
zeertzjq committed Jun 10, 2022
2 parents fc4e4b3 + 0c9d666 commit 1dba6cf
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/nvim/getchar.c
Original file line number Diff line number Diff line change
Expand Up @@ -1006,6 +1006,7 @@ int ins_char_typebuf(int c, int modifier)
buf[len + 1] = (char_u)K_SECOND(c);
buf[len + 2] = (char_u)K_THIRD(c);
buf[len + 3] = NUL;
len += 3;
} else {
char_u *end = add_char2buf(c, buf + len);
*end = NUL;
Expand Down
23 changes: 22 additions & 1 deletion test/functional/editor/meta_key_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,35 @@ describe('meta-keys #8226 #13042', function()
end)

it('ALT/META when recording a macro #13235', function()
command('inoremap <M-Esc> <lt>M-ESC>')
feed('ifoo<CR>bar<CR>baz<Esc>gg0')
-- <M-"> is reinterpreted as <Esc>"
feed('qrviw"ayC// This is some text: <M-">apq')
expect([[
// This is some text: foo
bar
baz]])
-- Should not insert an extra double quote when replaying
-- Should not insert an extra double quote or trigger <M-Esc> when replaying
feed('j0@rj0@@')
expect([[
// This is some text: foo
// This is some text: bar
// This is some text: baz]])
command('%delete')
end)

it('ALT/META with special key when recording a macro', function()
command('inoremap <M-Esc> <lt>M-ESC>')
command('noremap <S-Tab> "')
command('noremap! <S-Tab> "')
feed('ifoo<CR>bar<CR>baz<Esc>gg0')
-- <M-S-Tab> is reinterpreted as <Esc><S-Tab>
feed('qrviw<S-Tab>ayC// This is some text: <M-S-Tab>apq')
expect([[
// This is some text: foo
bar
baz]])
-- Should not insert an extra double quote or trigger <M-Esc> when replaying
feed('j0@rj0@@')
expect([[
// This is some text: foo
Expand Down

0 comments on commit 1dba6cf

Please sign in to comment.