aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Malcomson <hardenedapple@gmail.com>2017-03-28 19:42:44 +0100
committerMatthew Malcomson <hardenedapple@gmail.com>2018-01-27 11:44:15 +0000
commitdf4f9342b974c61860bfafd521faff56f62ceac4 (patch)
tree0a8acf7f2aecf9d04c1bbc885b3d5e90f3add5c1
parentf2ea15f36485b07a8754210c4ca5a08a0df076f0 (diff)
downloadrneovim-df4f9342b974c61860bfafd521faff56f62ceac4.tar.gz
rneovim-df4f9342b974c61860bfafd521faff56f62ceac4.tar.bz2
rneovim-df4f9342b974c61860bfafd521faff56f62ceac4.zip
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`.
-rw-r--r--src/nvim/macros.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/nvim/macros.h b/src/nvim/macros.h
index a98c1e05a0..0406574990 100644
--- a/src/nvim/macros.h
+++ b/src/nvim/macros.h
@@ -75,7 +75,7 @@
do { \
if (*p_langmap \
&& (condition) \
- && (p_lrm || KeyTyped) \
+ && (p_lrm || (vgetc_busy ? typebuf_maplen() == 0 : KeyTyped)) \
&& !KeyStuffed \
&& (c) >= 0) \
{ \