To: vim_dev@googlegroups.com
Subject: Patch 7.4.363
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 7.4.363
Problem:    In Windows console typing 0xCE does not work.
Solution:   Convert 0xCE to K_NUL 3. (Nobuhiro Takasaki et al.)
Files:	    src/os_win32.c, src/term.c


*** ../vim-7.4.362/src/os_win32.c	2014-04-01 21:00:45.436733663 +0200
--- src/os_win32.c	2014-07-09 20:29:30.787609327 +0200
***************
*** 619,625 ****
  	return FALSE;
      }
  
!     tokenPrivileges.PrivilegeCount           = 1;
      tokenPrivileges.Privileges[0].Luid       = luid;
      tokenPrivileges.Privileges[0].Attributes = bEnable ?
  						    SE_PRIVILEGE_ENABLED : 0;
--- 619,625 ----
  	return FALSE;
      }
  
!     tokenPrivileges.PrivilegeCount	     = 1;
      tokenPrivileges.Privileges[0].Luid       = luid;
      tokenPrivileges.Privileges[0].Attributes = bEnable ?
  						    SE_PRIVILEGE_ENABLED : 0;
***************
*** 1785,1797 ****
  #endif
  	    {
  		int	n = 1;
  
- 		/* A key may have one or two bytes. */
  		typeahead[typeaheadlen] = c;
  		if (ch2 != NUL)
  		{
! 		    typeahead[typeaheadlen + 1] = ch2;
! 		    ++n;
  		}
  #ifdef FEAT_MBYTE
  		/* Only convert normal characters, not special keys.  Need to
--- 1785,1798 ----
  #endif
  	    {
  		int	n = 1;
+ 		int     conv = FALSE;
  
  		typeahead[typeaheadlen] = c;
  		if (ch2 != NUL)
  		{
! 		    typeahead[typeaheadlen + 1] = 3;
! 		    typeahead[typeaheadlen + 2] = ch2;
! 		    n += 2;
  		}
  #ifdef FEAT_MBYTE
  		/* Only convert normal characters, not special keys.  Need to
***************
*** 1800,1805 ****
--- 1801,1807 ----
  		if (input_conv.vc_type != CONV_NONE
  						&& (ch2 == NUL || c != K_NUL))
  		{
+ 		    conv = TRUE;
  		    typeaheadlen -= unconverted;
  		    n = convert_input_safe(typeahead + typeaheadlen,
  				n + unconverted, TYPEAHEADLEN - typeaheadlen,
***************
*** 1807,1812 ****
--- 1809,1832 ----
  		}
  #endif
  
+ 		if (conv)
+ 		{
+ 		    char_u *p = typeahead + typeaheadlen;
+ 		    char_u *e = typeahead + TYPEAHEADLEN;
+ 
+ 		    while (*p && p < e)
+ 		    {
+ 			if (*p == K_NUL)
+ 			{
+ 			    ++p;
+ 			    mch_memmove(p + 1, p, ((size_t)(e - p)) - 1);
+ 			    *p = 3;
+ 			    ++n;
+ 			}
+ 			++p;
+ 		    }
+ 		}
+ 
  		/* Use the ALT key to set the 8th bit of the character
  		 * when it's one byte, the 8th bit isn't set yet and not
  		 * using a double-byte encoding (would become a lead
*** ../vim-7.4.362/src/term.c	2014-07-09 19:13:45.003701718 +0200
--- src/term.c	2014-07-09 20:26:28.655613029 +0200
***************
*** 3724,3730 ****
--- 3724,3734 ----
  	return;
      }
  
+ #if defined(WIN3264) && !defined(FEAT_GUI)
+     s = vim_strnsave(string, (int)STRLEN(string) + 1);
+ #else
      s = vim_strsave(string);
+ #endif
      if (s == NULL)
  	return;
  
***************
*** 3734,3739 ****
--- 3738,3752 ----
  	STRMOVE(s, s + 1);
  	s[0] = term_7to8bit(string);
      }
+ 
+ #if defined(WIN3264) && !defined(FEAT_GUI)
+     if (s[0] == K_NUL)
+     {
+         STRMOVE(s + 1, s);
+         s[1] = 3;
+     }
+ #endif
+ 
      len = (int)STRLEN(s);
  
      need_gather = TRUE;		/* need to fill termleader[] */
*** ../vim-7.4.362/src/version.c	2014-07-09 20:20:40.359620108 +0200
--- src/version.c	2014-07-09 20:26:38.903612821 +0200
***************
*** 736,737 ****
--- 736,739 ----
  {   /* Add new patch number below this line */
+ /**/
+     363,
  /**/

-- 
BROTHER MAYNARD: Armaments Chapter Two Verses Nine to Twenty One.
ANOTHER MONK:    And St.  Attila raised his hand grenade up on high saying "O
                 Lord bless this thy hand grenade that with it thou mayest
                 blow thine enemies to tiny bits, in thy mercy. "and the Lord
                 did grin and people did feast upon the lambs and sloths and
                 carp and anchovies and orang-utans and breakfast cereals and
                 fruit bats and...
BROTHER MAYNARD: Skip a bit brother ...
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
