updated for version 7.4.502
Problem: Language mapping also applies to mapped characters.
Solution: Add the 'langnoremap' option, when on 'langmap' does not apply to
mapped characters. (Christian Brabandt)
diff --git a/src/macros.h b/src/macros.h
index 2706a02..01207d9 100644
--- a/src/macros.h
+++ b/src/macros.h
@@ -128,13 +128,18 @@
* Adjust chars in a language according to 'langmap' option.
* NOTE that there is no noticeable overhead if 'langmap' is not set.
* When set the overhead for characters < 256 is small.
- * Don't apply 'langmap' if the character comes from the Stuff buffer.
+ * Don't apply 'langmap' if the character comes from the Stuff buffer or from
+ * a mapping and the langnoremap option was set.
* The do-while is just to ignore a ';' after the macro.
*/
# ifdef FEAT_MBYTE
# define LANGMAP_ADJUST(c, condition) \
do { \
- if (*p_langmap && (condition) && !KeyStuffed && (c) >= 0) \
+ if (*p_langmap \
+ && (condition) \
+ && (!p_lnr || (p_lnr && typebuf_maplen() == 0)) \
+ && !KeyStuffed \
+ && (c) >= 0) \
{ \
if ((c) < 256) \
c = langmap_mapchar[c]; \
@@ -145,7 +150,11 @@
# else
# define LANGMAP_ADJUST(c, condition) \
do { \
- if (*p_langmap && (condition) && !KeyStuffed && (c) >= 0 && (c) < 256) \
+ if (*p_langmap \
+ && (condition) \
+ && (!p_lnr || (p_lnr && typebuf_maplen() == 0)) \
+ && !KeyStuffed \
+ && (c) >= 0 && (c) < 256) \
c = langmap_mapchar[c]; \
} while (0)
# endif
diff --git a/src/option.c b/src/option.c
index 5e8e95a..6841d42 100644
--- a/src/option.c
+++ b/src/option.c
@@ -1691,6 +1691,13 @@
(char_u *)NULL, PV_NONE,
#endif
{(char_u *)"", (char_u *)0L} SCRIPTID_INIT},
+ {"langnoremap", "lnr", P_BOOL|P_VI_DEF,
+#ifdef FEAT_LANGMAP
+ (char_u *)&p_lnr, PV_NONE,
+#else
+ (char_u *)NULL, PV_NONE,
+#endif
+ {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT},
{"laststatus", "ls", P_NUM|P_VI_DEF|P_RALL,
#ifdef FEAT_WINDOWS
(char_u *)&p_ls, PV_NONE,
diff --git a/src/option.h b/src/option.h
index 23cdecd..b031466 100644
--- a/src/option.h
+++ b/src/option.h
@@ -576,6 +576,7 @@
EXTERN char_u *p_km; /* 'keymodel' */
#ifdef FEAT_LANGMAP
EXTERN char_u *p_langmap; /* 'langmap'*/
+EXTERN int p_lnr; /* 'langnoremap' */
#endif
#if defined(FEAT_MENU) && defined(FEAT_MULTI_LANG)
EXTERN char_u *p_lm; /* 'langmenu' */
diff --git a/src/version.c b/src/version.c
index 3c48dc4..7bc7153 100644
--- a/src/version.c
+++ b/src/version.c
@@ -742,6 +742,8 @@
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 502,
+/**/
501,
/**/
500,