3ef2ca
To: vim_dev@googlegroups.com
3ef2ca
Subject: Patch 7.4.204
3ef2ca
Fcc: outbox
3ef2ca
From: Bram Moolenaar <Bram@moolenaar.net>
3ef2ca
Mime-Version: 1.0
3ef2ca
Content-Type: text/plain; charset=UTF-8
3ef2ca
Content-Transfer-Encoding: 8bit
3ef2ca
------------
3ef2ca
3ef2ca
Patch 7.4.204
3ef2ca
Problem:    A mapping where the second byte is 0x80 doesn't work.
3ef2ca
Solution:   Unescape before checking for incomplete multi-byte char. (Nobuhiro
3ef2ca
	    Takasaki)
3ef2ca
Files:	    src/getchar.c, src/testdir/test75.in, src/testdir/test75.ok
3ef2ca
3ef2ca
3ef2ca
*** ../vim-7.4.203/src/getchar.c	2014-02-15 16:17:02.213903042 +0100
3ef2ca
--- src/getchar.c	2014-03-12 20:06:17.944971557 +0100
3ef2ca
***************
3ef2ca
*** 2206,2215 ****
3ef2ca
  #ifdef FEAT_MBYTE
3ef2ca
  				/* Don't allow mapping the first byte(s) of a
3ef2ca
  				 * multi-byte char.  Happens when mapping
3ef2ca
! 				 * <M-a> and then changing 'encoding'. */
3ef2ca
! 				if (has_mbyte && MB_BYTE2LEN(c1)
3ef2ca
! 						  > (*mb_ptr2len)(mp->m_keys))
3ef2ca
! 				    mlen = 0;
3ef2ca
  #endif
3ef2ca
  				/*
3ef2ca
  				 * Check an entry whether it matches.
3ef2ca
--- 2206,2221 ----
3ef2ca
  #ifdef FEAT_MBYTE
3ef2ca
  				/* Don't allow mapping the first byte(s) of a
3ef2ca
  				 * multi-byte char.  Happens when mapping
3ef2ca
! 				 * <M-a> and then changing 'encoding'. Beware
3ef2ca
! 				 * that 0x80 is escaped. */
3ef2ca
! 				{
3ef2ca
! 				    char_u *p1 = mp->m_keys;
3ef2ca
! 				    char_u *p2 = mb_unescape(&p1;;
3ef2ca
! 
3ef2ca
! 				    if (has_mbyte && p2 != NULL
3ef2ca
! 					  && MB_BYTE2LEN(c1) > MB_PTR2LEN(p2))
3ef2ca
! 					mlen = 0;
3ef2ca
! 				}
3ef2ca
  #endif
3ef2ca
  				/*
3ef2ca
  				 * Check an entry whether it matches.
3ef2ca
*** ../vim-7.4.203/src/testdir/test75.in	2013-11-02 04:19:10.000000000 +0100
3ef2ca
--- src/testdir/test75.in	2014-03-12 20:02:45.932968308 +0100
3ef2ca
***************
3ef2ca
*** 1,8 ****
3ef2ca
--- 1,11 ----
3ef2ca
  Tests for maparg().
3ef2ca
+ Also test utf8 map with a 0x80 byte.
3ef2ca
  
3ef2ca
  STARTTEST
3ef2ca
  :so small.vim
3ef2ca
+ :so mbyte.vim
3ef2ca
  :set cpo-=<
3ef2ca
+ :set encoding=utf8
3ef2ca
  :" Test maparg() with a string result
3ef2ca
  :map foo<C-V> is<F4>foo
3ef2ca
  :vnoremap <script> <buffer> <expr> <silent> bar isbar
3ef2ca
***************
3ef2ca
*** 17,22 ****
3ef2ca
--- 20,39 ----
3ef2ca
  :map abc y<S-char-114>y
3ef2ca
  :call append('$', maparg('abc'))
3ef2ca
  :"
3ef2ca
+ Go?:"
3ef2ca
+ :" Outside of the range, minimum
3ef2ca
+ :inoremap <Char-0x1040> a
3ef2ca
+ :call feedkeys("a\u1040\<Esc>")
3ef2ca
+ :" Inside of the range, minimum
3ef2ca
+ :inoremap <Char-0x103f> b
3ef2ca
+ :call feedkeys("a\u103f\<Esc>")
3ef2ca
+ :" Inside of the range, maximum
3ef2ca
+ :inoremap <Char-0xf03f> c
3ef2ca
+ :call feedkeys("a\uf03f\<Esc>")
3ef2ca
+ :" Outside of the range, maximum
3ef2ca
+ :inoremap <Char-0xf040> d
3ef2ca
+ :call feedkeys("a\uf040\<Esc>")
3ef2ca
+ :"
3ef2ca
  :/^eof/+1,$w! test.out
3ef2ca
  :qa!
3ef2ca
  ENDTEST
3ef2ca
*** ../vim-7.4.203/src/testdir/test75.ok	2013-06-29 13:50:08.000000000 +0200
3ef2ca
--- src/testdir/test75.ok	2014-03-12 20:02:49.780968367 +0100
3ef2ca
***************
3ef2ca
*** 4,6 ****
3ef2ca
--- 4,7 ----
3ef2ca
  {'silent': 0, 'noremap': 0, 'lhs': 'foo', 'mode': ' ', 'nowait': 1, 'expr': 0, 'sid': 0, 'rhs': 'bar', 'buffer': 1}
3ef2ca
  xrx
3ef2ca
  yRy
3ef2ca
+ abcd
3ef2ca
*** ../vim-7.4.203/src/version.c	2014-03-12 19:41:37.100948866 +0100
3ef2ca
--- src/version.c	2014-03-12 20:06:43.684971951 +0100
3ef2ca
***************
3ef2ca
*** 740,741 ****
3ef2ca
--- 740,743 ----
3ef2ca
  {   /* Add new patch number below this line */
3ef2ca
+ /**/
3ef2ca
+     204,
3ef2ca
  /**/
3ef2ca
3ef2ca
-- 
3ef2ca
If you only have a hammer, you tend to see every problem as a nail.
3ef2ca
If you only have MS-Windows, you tend to solve every problem by rebooting.
3ef2ca
3ef2ca
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
3ef2ca
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
3ef2ca
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
3ef2ca
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///