diff src/os_win32.c @ 6047:ff3816167b73 v7.4.363

updated for version 7.4.363 Problem: In Windows console typing 0xCE does not work. Solution: Convert 0xCE to K_NUL 3. (Nobuhiro Takasaki et al.)
author Bram Moolenaar <bram@vim.org>
date Wed, 09 Jul 2014 20:51:07 +0200
parents 5ab2946f7ce5
children 1fe61f6d5207
line wrap: on
line diff
--- a/src/os_win32.c
+++ b/src/os_win32.c
@@ -619,7 +619,7 @@ win32_enable_privilege(LPTSTR lpszPrivil
 	return FALSE;
     }
 
-    tokenPrivileges.PrivilegeCount           = 1;
+    tokenPrivileges.PrivilegeCount	     = 1;
     tokenPrivileges.Privileges[0].Luid       = luid;
     tokenPrivileges.Privileges[0].Attributes = bEnable ?
 						    SE_PRIVILEGE_ENABLED : 0;
@@ -1785,13 +1785,14 @@ mch_inchar(
 #endif
 	    {
 		int	n = 1;
-
-		/* A key may have one or two bytes. */
+		int     conv = FALSE;
+
 		typeahead[typeaheadlen] = c;
 		if (ch2 != NUL)
 		{
-		    typeahead[typeaheadlen + 1] = ch2;
-		    ++n;
+		    typeahead[typeaheadlen + 1] = 3;
+		    typeahead[typeaheadlen + 2] = ch2;
+		    n += 2;
 		}
 #ifdef FEAT_MBYTE
 		/* Only convert normal characters, not special keys.  Need to
@@ -1800,6 +1801,7 @@ mch_inchar(
 		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,6 +1809,24 @@ mch_inchar(
 		}
 #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