[vim/vim] mapping: modifier is not recognized after a partial mapping (PR #20898)
h_east (Vim Github Repository) <[email protected]> Fri, 31 Jul 2026 10:58:58 -0700
| Newsgroups | gmane.editors.vim.devel |
|---|---|
| Message-ID | <vim/vim/pull/[email protected]> |
```
Problem: With the key protocol enabled, a mapping for a key with a modifier
is not used when it follows a partial match of another mapping.
Solution: When the modifier was merged into the key in the typeahead, mark
the key, so that the mapping for the simplified key can be used.
```
fixes: #12002
---
Typing "a" then CTRL-J in Insert mode inserted "a" and a line break instead
of "ax". The cause was found by @zeertzjq in the issue: while looking for a
mapping starting with "a", the modifier of CTRL-J is merged into the key, and
the mapping for the simplified key is then skipped because the key protocol
is enabled.
That mapping is skipped so a NL typed by the user does not use a mapping for
CTRL-J. The reason does not hold for a key that Vim simplified itself, so
those are now marked in typebuf.tb_noremap[]. The added test also checks
that a real NL still does not use the mapping.
The flag is a new bit in tb_noremap[]. All uses of that array are in
getchar.c; the one place where the value leaves the file, KeyNoremap, masks
the bit out.
You can view, comment on, or merge this pull request online at:
https://github.com/vim/vim/pull/20898
-- Commit Summary --
* mapping: modifier is not recognized after a partial mapping
-- File Changes --
M runtime/doc/todo.txt (4)
M src/getchar.c (24)
M src/testdir/test_termcodes.vim (24)
-- Patch Links --
https://github.com/vim/vim/pull/20898.patch
https://github.com/vim/vim/pull/20898.diff
--
Reply to this email directly or view it on GitHub:
https://github.com/vim/vim/pull/20898
You are receiving this because you are subscribed to this thread.
Message ID: <vim/vim/pull/[email protected]>
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion visit https://groups.google.com/d/msgid/vim_dev/vim/vim/pull/20898%40github.com.