[vim/vim] mapping: modifier is not recognized after a partial mapping (PR #20898)

1 view
Skip to first unread message

h_east

unread,
1:59 PM (8 hours ago) 1:59 PM
to vim/vim, Subscribed
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

  • 71cd284 mapping: modifier is not recognized after a partial mapping

File Changes

(3 files)

Patch Links:


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/20898@github.com>

Reply all
Reply to author
Forward
0 new messages