mirror of
https://github.com/neovim/neovim.git
synced 2024-12-24 13:15:09 -07:00
Make 'langnoremap' apply directly after a map
We were initially checking whether to apply 'langmap' translation based
on typebuf.tb_maplen.
This gets set to 0 on the last byte of a map when the del_typebuf()
function is called, which means that the option was not working for the
last character of a mapping.
For this reason, we switched to using KeyTyped to decide whether to
apply the transformation or not in commit 53da57d27
.
Substituting one for the other isn't enough, because KeyTyped isn't set
until vgetorpeek() is returning.
This means 'langmap' translations are not applied when searching for
characters to map in the vgetorpeek() function if the *previous* key was
not typed.
We can't assert that both hold, as we would then *not* apply the
transformation when looking for a map starting with the first typed key
after a previously expanded map (as KeyTyped would be `false` from the
previously expanded map, and not yet reset).
Hence we assert that if we are looking for the mapping while in
vgetorpeek(), the map length should be zero, otherwise, KeyTyped must be
`true`.
This is implemented by checking for the variable `vgetc_busy`.
This commit is contained in:
parent
f2ea15f364
commit
df4f9342b9
@ -75,7 +75,7 @@
|
||||
do { \
|
||||
if (*p_langmap \
|
||||
&& (condition) \
|
||||
&& (p_lrm || KeyTyped) \
|
||||
&& (p_lrm || (vgetc_busy ? typebuf_maplen() == 0 : KeyTyped)) \
|
||||
&& !KeyStuffed \
|
||||
&& (c) >= 0) \
|
||||
{ \
|
||||
|
Loading…
Reference in New Issue
Block a user