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