Blame SOURCES/7.4.502

22c937
To: vim_dev@googlegroups.com
22c937
Subject: Patch 7.4.502
22c937
Fcc: outbox
22c937
From: Bram Moolenaar <Bram@moolenaar.net>
22c937
Mime-Version: 1.0
22c937
Content-Type: text/plain; charset=UTF-8
22c937
Content-Transfer-Encoding: 8bit
22c937
------------
22c937
22c937
Patch 7.4.502
22c937
Problem:    Language mapping also applies to mapped characters.
22c937
Solution:   Add the 'langnoremap' option, when on 'langmap' does not apply to
22c937
	    mapped characters. (Christian Brabandt)
22c937
Files:	    runtime/doc/options.txt, runtime/vimrc_example.vim, src/macros.h,
22c937
	    src/option.c, src/option.h
22c937
22c937
22c937
*** ../vim-7.4.501/runtime/doc/options.txt	2014-11-05 14:26:30.760758363 +0100
22c937
--- runtime/doc/options.txt	2014-11-05 17:21:15.676505715 +0100
22c937
***************
22c937
*** 4533,4538 ****
22c937
--- 4534,4543 ----
22c937
  	be able to execute Normal mode commands.
22c937
  	This is the opposite of the 'keymap' option, where characters are
22c937
  	mapped in Insert mode.
22c937
+ 	Also consider setting 'langnoremap' to avoid 'langmap' applies to
22c937
+ 	characters resulting from a mapping.
22c937
+ 	This option cannot be set from a |modeline| or in the |sandbox|, for
22c937
+ 	security reasons.
22c937
  
22c937
  	Example (for Greek, in UTF-8):				*greek*  >
22c937
  	    :set langmap=ΑA,ΒB,ΨC,ΔD,ΕE,ΦF,ΓG,ΗH,ΙI,ΞJ,ΚK,ΛL,ΜM,ΝN,ΟO,ΠP,QQ,ΡR,ΣS,ΤT,ΘU,ΩV,WW,ΧX,ΥY,ΖZ,αa,βb,ψc,δd,εe,φf,γg,ηh,ιi,ξj,κk,λl,μm,νn,οo,πp,qq,ρr,σs,τt,θu,ωv,ςw,χx,υy,ζz
22c937
***************
22c937
*** 4586,4591 ****
22c937
--- 4591,4608 ----
22c937
  		:source $VIMRUNTIME/menu.vim
22c937
  <	Warning: This deletes all menus that you defined yourself!
22c937
  
22c937
+ 					*'langnoremap'* *'lnr'*
22c937
+ 'langnoremap' 'lnr'	boolean (default off)
22c937
+ 			global
22c937
+ 			{not in Vi}
22c937
+ 			{only available when compiled with the |+langmap|
22c937
+ 			feature}
22c937
+ 	When on, setting 'langmap' does not apply to characters resulting from
22c937
+ 	a mapping.  This basically means, if you noticed that setting
22c937
+ 	'langmap' disables some of your mappings, try setting this option.
22c937
+ 	This option defaults to off for backwards compatibility.  Set it on if
22c937
+ 	that works for you to avoid mappings to break.
22c937
+ 
22c937
  					*'laststatus'* *'ls'*
22c937
  'laststatus' 'ls'	number	(default 1)
22c937
  			global
22c937
*** ../vim-7.4.501/runtime/vimrc_example.vim	2014-02-05 22:01:56.686546587 +0100
22c937
--- runtime/vimrc_example.vim	2014-11-05 17:23:26.808502555 +0100
22c937
***************
22c937
*** 1,7 ****
22c937
  " An example for a vimrc file.
22c937
  "
22c937
  " Maintainer:	Bram Moolenaar <Bram@vim.org>
22c937
! " Last change:	2014 Feb 05
22c937
  "
22c937
  " To use it, copy it to
22c937
  "     for Unix and OS/2:  ~/.vimrc
22c937
--- 1,7 ----
22c937
  " An example for a vimrc file.
22c937
  "
22c937
  " Maintainer:	Bram Moolenaar <Bram@vim.org>
22c937
! " Last change:	2014 Nov 05
22c937
  "
22c937
  " To use it, copy it to
22c937
  "     for Unix and OS/2:  ~/.vimrc
22c937
***************
22c937
*** 95,97 ****
22c937
--- 95,104 ----
22c937
    command DiffOrig vert new | set bt=nofile | r ++edit # | 0d_ | diffthis
22c937
  		  \ | wincmd p | diffthis
22c937
  endif
22c937
+ 
22c937
+ if has('langmap') && exists('+langnoremap')
22c937
+   " Prevent that the langmap option applies to characters that result from a
22c937
+   " mapping.  If unset (default), this may break plugins (but it's backward
22c937
+   " compatible).
22c937
+   set langnoremap
22c937
+ endif
22c937
*** ../vim-7.4.501/src/macros.h	2014-05-13 20:19:53.569808877 +0200
22c937
--- src/macros.h	2014-11-05 17:26:42.172497848 +0100
22c937
***************
22c937
*** 128,140 ****
22c937
   * Adjust chars in a language according to 'langmap' option.
22c937
   * NOTE that there is no noticeable overhead if 'langmap' is not set.
22c937
   * When set the overhead for characters < 256 is small.
22c937
!  * Don't apply 'langmap' if the character comes from the Stuff buffer.
22c937
   * The do-while is just to ignore a ';' after the macro.
22c937
   */
22c937
  # ifdef FEAT_MBYTE
22c937
  #  define LANGMAP_ADJUST(c, condition) \
22c937
      do { \
22c937
! 	if (*p_langmap && (condition) && !KeyStuffed && (c) >= 0) \
22c937
  	{ \
22c937
  	    if ((c) < 256) \
22c937
  		c = langmap_mapchar[c]; \
22c937
--- 128,145 ----
22c937
   * Adjust chars in a language according to 'langmap' option.
22c937
   * NOTE that there is no noticeable overhead if 'langmap' is not set.
22c937
   * When set the overhead for characters < 256 is small.
22c937
!  * Don't apply 'langmap' if the character comes from the Stuff buffer or from
22c937
!  * a mapping and the langnoremap option was set.
22c937
   * The do-while is just to ignore a ';' after the macro.
22c937
   */
22c937
  # ifdef FEAT_MBYTE
22c937
  #  define LANGMAP_ADJUST(c, condition) \
22c937
      do { \
22c937
! 	if (*p_langmap \
22c937
! 		&& (condition) \
22c937
! 		&& (!p_lnr || (p_lnr && typebuf_maplen() == 0)) \
22c937
! 		&& !KeyStuffed \
22c937
! 		&& (c) >= 0) \
22c937
  	{ \
22c937
  	    if ((c) < 256) \
22c937
  		c = langmap_mapchar[c]; \
22c937
***************
22c937
*** 145,151 ****
22c937
  # else
22c937
  #  define LANGMAP_ADJUST(c, condition) \
22c937
      do { \
22c937
! 	if (*p_langmap && (condition) && !KeyStuffed && (c) >= 0 && (c) < 256) \
22c937
  	    c = langmap_mapchar[c]; \
22c937
      } while (0)
22c937
  # endif
22c937
--- 150,160 ----
22c937
  # else
22c937
  #  define LANGMAP_ADJUST(c, condition) \
22c937
      do { \
22c937
! 	if (*p_langmap \
22c937
! 		&& (condition) \
22c937
! 		&& (!p_lnr || (p_lnr && typebuf_maplen() == 0)) \
22c937
! 		&& !KeyStuffed \
22c937
! 		&& (c) >= 0 && (c) < 256) \
22c937
  	    c = langmap_mapchar[c]; \
22c937
      } while (0)
22c937
  # endif
22c937
*** ../vim-7.4.501/src/option.c	2014-09-29 17:15:09.963945227 +0200
22c937
--- src/option.c	2014-11-05 17:17:44.208510810 +0100
22c937
***************
22c937
*** 1691,1696 ****
22c937
--- 1691,1703 ----
22c937
  			    (char_u *)NULL, PV_NONE,
22c937
  #endif
22c937
  			    {(char_u *)"", (char_u *)0L} SCRIPTID_INIT},
22c937
+     {"langnoremap",  "lnr",   P_BOOL|P_VI_DEF,
22c937
+ #ifdef FEAT_LANGMAP
22c937
+ 			    (char_u *)&p_lnr, PV_NONE,
22c937
+ #else
22c937
+ 			    (char_u *)NULL, PV_NONE,
22c937
+ #endif
22c937
+ 			    {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT},
22c937
      {"laststatus",  "ls",   P_NUM|P_VI_DEF|P_RALL,
22c937
  #ifdef FEAT_WINDOWS
22c937
  			    (char_u *)&p_ls, PV_NONE,
22c937
*** ../vim-7.4.501/src/option.h	2014-09-23 15:45:04.870801055 +0200
22c937
--- src/option.h	2014-11-05 17:17:44.212510810 +0100
22c937
***************
22c937
*** 576,581 ****
22c937
--- 576,582 ----
22c937
  EXTERN char_u	*p_km;		/* 'keymodel' */
22c937
  #ifdef FEAT_LANGMAP
22c937
  EXTERN char_u	*p_langmap;	/* 'langmap'*/
22c937
+ EXTERN int	p_lnr;		/* 'langnoremap' */
22c937
  #endif
22c937
  #if defined(FEAT_MENU) && defined(FEAT_MULTI_LANG)
22c937
  EXTERN char_u	*p_lm;		/* 'langmenu' */
22c937
*** ../vim-7.4.501/src/version.c	2014-11-05 17:04:10.516530418 +0100
22c937
--- src/version.c	2014-11-05 17:15:31.820514001 +0100
22c937
***************
22c937
*** 743,744 ****
22c937
--- 743,746 ----
22c937
  {   /* Add new patch number below this line */
22c937
+ /**/
22c937
+     502,
22c937
  /**/
22c937
22c937
-- 
22c937
MARTHA'S WAY: Don't throw out all that leftover wine. Freeze into ice cubes
22c937
              for future use in casseroles and sauces.
22c937
MY WAY:       What leftover wine?
22c937
22c937
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
22c937
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
22c937
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
22c937
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///