mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 03:18:16 +00:00
fix(api): use E226 instead of E227 for duplicate abbreviation (#33159)
(cherry picked from commit 99529577cc
)
This commit is contained in:

committed by
github-actions[bot]
![github-actions[bot]](/assets/img/avatar_default.png)
parent
1e8e74dbff
commit
2b2a90051e
@@ -2804,7 +2804,9 @@ void modify_keymap(uint64_t channel_id, Buffer buffer, bool is_unmap, String mod
|
|||||||
api_set_error(err, kErrorTypeException, e_nomap, 0);
|
api_set_error(err, kErrorTypeException, e_nomap, 0);
|
||||||
goto fail_and_free;
|
goto fail_and_free;
|
||||||
case 5:
|
case 5:
|
||||||
api_set_error(err, kErrorTypeException, e_mapping_already_exists_for_str, lhs.data);
|
api_set_error(err, kErrorTypeException,
|
||||||
|
is_abbrev ? e_abbreviation_already_exists_for_str
|
||||||
|
: e_mapping_already_exists_for_str, lhs.data);
|
||||||
goto fail_and_free;
|
goto fail_and_free;
|
||||||
default:
|
default:
|
||||||
assert(false && "Unrecognized return code!");
|
assert(false && "Unrecognized return code!");
|
||||||
|
@@ -814,6 +814,12 @@ describe('nvim_set_keymap, nvim_del_keymap', function()
|
|||||||
'E227: Mapping already exists for <tab>',
|
'E227: Mapping already exists for <tab>',
|
||||||
pcall_err(api.nvim_set_keymap, 'n', '<tab>', 'rhs', { unique = true })
|
pcall_err(api.nvim_set_keymap, 'n', '<tab>', 'rhs', { unique = true })
|
||||||
)
|
)
|
||||||
|
|
||||||
|
api.nvim_set_keymap('ia', 'lhs', 'rhs', {})
|
||||||
|
eq(
|
||||||
|
'E226: Abbreviation already exists for lhs',
|
||||||
|
pcall_err(api.nvim_set_keymap, 'ia', 'lhs', 'rhs', { unique = true })
|
||||||
|
)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('can set <expr> mappings whose RHS change dynamically', function()
|
it('can set <expr> mappings whose RHS change dynamically', function()
|
||||||
|
Reference in New Issue
Block a user