mirror of
https://github.com/neovim/neovim.git
synced 2025-09-27 21:48:35 +00:00
feat(mappings): do not simplify the rhs of a mapping
This commit is contained in:
@@ -366,8 +366,9 @@ Macro/|recording| behavior
|
||||
the results of keys from 'keymap'.
|
||||
|
||||
Mappings:
|
||||
Creating a mapping for a simplifiable key (e.g. <C-I>) doesn't replace an
|
||||
- Creating a mapping for a simplifiable key (e.g. <C-I>) doesn't replace an
|
||||
existing mapping for its simplified form (e.g. <Tab>).
|
||||
- The rhs of a mapping is not simplified when it is defined.
|
||||
|
||||
Motion:
|
||||
The |jumplist| avoids useless/phantom jumps.
|
||||
|
@@ -2885,8 +2885,8 @@ void set_maparg_lhs_rhs(const char_u *const orig_lhs, const size_t orig_lhs_len,
|
||||
mapargs->rhs_len = 0;
|
||||
mapargs->rhs_is_noop = true;
|
||||
} else {
|
||||
replaced = replace_termcodes(orig_rhs, orig_rhs_len, &rhs_buf, REPTERM_DO_LT, NULL,
|
||||
cpo_flags);
|
||||
replaced = replace_termcodes(orig_rhs, orig_rhs_len, &rhs_buf,
|
||||
REPTERM_DO_LT | REPTERM_NO_SIMPLIFY, NULL, cpo_flags);
|
||||
mapargs->rhs_len = STRLEN(replaced);
|
||||
mapargs->rhs_is_noop = false;
|
||||
mapargs->rhs = xcalloc(mapargs->rhs_len + 1, sizeof(char_u));
|
||||
|
@@ -313,6 +313,11 @@ it('unsimplified mapping works when there was a partial match vim-patch:8.2.4504
|
||||
expect('xb')
|
||||
end)
|
||||
|
||||
it('rhs of a mapping is not simplified', function()
|
||||
command('nnoremap <Plug>foo <C-J>')
|
||||
eq('<C-J>', funcs.maparg('<Plug>foo'))
|
||||
end)
|
||||
|
||||
describe('input non-printable chars', function()
|
||||
after_each(function()
|
||||
os.remove('Xtest-overwrite')
|
||||
|
Reference in New Issue
Block a user