Karsten Hopp 52b8c5
To: vim_dev@googlegroups.com
Karsten Hopp 52b8c5
Subject: Patch 7.4.142
Karsten Hopp 52b8c5
Fcc: outbox
Karsten Hopp 52b8c5
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 52b8c5
Mime-Version: 1.0
Karsten Hopp 52b8c5
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 52b8c5
Content-Transfer-Encoding: 8bit
Karsten Hopp 52b8c5
------------
Karsten Hopp 52b8c5
Karsten Hopp 52b8c5
Patch 7.4.142 (after 7.4.137)
Karsten Hopp 52b8c5
Problem:    On MS-Windows 8 IME input doen't work correctly.
Karsten Hopp 52b8c5
Solution:   Work around the problem. (Nobuhiro Takasaki)
Karsten Hopp 52b8c5
Files:	    src/os_win32.c
Karsten Hopp 52b8c5
Karsten Hopp 52b8c5
Karsten Hopp 52b8c5
*** ../vim-7.4.141/src/os_win32.c	2014-01-10 18:16:00.000000000 +0100
Karsten Hopp 52b8c5
--- src/os_win32.c	2014-01-12 13:23:24.000000000 +0100
Karsten Hopp 52b8c5
***************
Karsten Hopp 52b8c5
*** 234,289 ****
Karsten Hopp 52b8c5
  
Karsten Hopp 52b8c5
  /*
Karsten Hopp 52b8c5
   * Version of ReadConsoleInput() that works with IME.
Karsten Hopp 52b8c5
   */
Karsten Hopp 52b8c5
      static BOOL
Karsten Hopp 52b8c5
  read_console_input(
Karsten Hopp 52b8c5
!     HANDLE hConsoleInput,
Karsten Hopp 52b8c5
!     PINPUT_RECORD lpBuffer,
Karsten Hopp 52b8c5
!     DWORD nLength,
Karsten Hopp 52b8c5
!     LPDWORD lpNumberOfEventsRead)
Karsten Hopp 52b8c5
  {
Karsten Hopp 52b8c5
      enum
Karsten Hopp 52b8c5
      {
Karsten Hopp 52b8c5
! 	IRSIZE = 10, /* rough value */
Karsten Hopp 52b8c5
      };
Karsten Hopp 52b8c5
!     static INPUT_RECORD irCache[IRSIZE];
Karsten Hopp 52b8c5
      static DWORD s_dwIndex = 0;
Karsten Hopp 52b8c5
      static DWORD s_dwMax = 0;
Karsten Hopp 52b8c5
! 
Karsten Hopp 52b8c5
!     if (hConsoleInput == NULL || lpBuffer == NULL)
Karsten Hopp 52b8c5
! 	return ReadConsoleInput(hConsoleInput, lpBuffer, nLength,
Karsten Hopp 52b8c5
! 							lpNumberOfEventsRead);
Karsten Hopp 52b8c5
! 
Karsten Hopp 52b8c5
!     if (nLength == -1)
Karsten Hopp 52b8c5
!     {
Karsten Hopp 52b8c5
! 	if (s_dwMax == 0)
Karsten Hopp 52b8c5
! 	{
Karsten Hopp 52b8c5
! 	    PeekConsoleInput(hConsoleInput, lpBuffer, 1, lpNumberOfEventsRead);
Karsten Hopp 52b8c5
! 	    if (*lpNumberOfEventsRead == 0)
Karsten Hopp 52b8c5
! 		return FALSE;
Karsten Hopp 52b8c5
! 	    ReadConsoleInput(hConsoleInput, irCache, IRSIZE, &s_dwMax);
Karsten Hopp 52b8c5
! 	    s_dwIndex = 0;
Karsten Hopp 52b8c5
! 	}
Karsten Hopp 52b8c5
! 	((PINPUT_RECORD)lpBuffer)[0] = irCache[s_dwIndex];
Karsten Hopp 52b8c5
! 	*lpNumberOfEventsRead = 1;
Karsten Hopp 52b8c5
! 	return TRUE;
Karsten Hopp 52b8c5
!     }
Karsten Hopp 52b8c5
  
Karsten Hopp 52b8c5
      if (s_dwMax == 0)
Karsten Hopp 52b8c5
      {
Karsten Hopp 52b8c5
! 	ReadConsoleInput(hConsoleInput, irCache, IRSIZE, &s_dwMax);
Karsten Hopp 52b8c5
  	s_dwIndex = 0;
Karsten Hopp 52b8c5
! 	if (s_dwMax == 0)
Karsten Hopp 52b8c5
  	{
Karsten Hopp 52b8c5
! 	    *lpNumberOfEventsRead = 0;
Karsten Hopp 52b8c5
! 	    return FALSE;
Karsten Hopp 52b8c5
  	}
Karsten Hopp 52b8c5
      }
Karsten Hopp 52b8c5
! 
Karsten Hopp 52b8c5
!     ((PINPUT_RECORD)lpBuffer)[0] = irCache[s_dwIndex];
Karsten Hopp 52b8c5
!     if (++s_dwIndex == s_dwMax)
Karsten Hopp 52b8c5
  	s_dwMax = 0;
Karsten Hopp 52b8c5
!     *lpNumberOfEventsRead = 1;
Karsten Hopp 52b8c5
      return TRUE;
Karsten Hopp 52b8c5
  }
Karsten Hopp 52b8c5
  
Karsten Hopp 52b8c5
--- 234,275 ----
Karsten Hopp 52b8c5
  
Karsten Hopp 52b8c5
  /*
Karsten Hopp 52b8c5
   * Version of ReadConsoleInput() that works with IME.
Karsten Hopp 52b8c5
+  * Works around problems on Windows 8.
Karsten Hopp 52b8c5
   */
Karsten Hopp 52b8c5
      static BOOL
Karsten Hopp 52b8c5
  read_console_input(
Karsten Hopp 52b8c5
!     HANDLE	    hInput,
Karsten Hopp 52b8c5
!     INPUT_RECORD    *lpBuffer,
Karsten Hopp 52b8c5
!     DWORD	    nLength,
Karsten Hopp 52b8c5
!     LPDWORD	    lpEvents)
Karsten Hopp 52b8c5
  {
Karsten Hopp 52b8c5
      enum
Karsten Hopp 52b8c5
      {
Karsten Hopp 52b8c5
! 	IRSIZE = 10
Karsten Hopp 52b8c5
      };
Karsten Hopp 52b8c5
!     static INPUT_RECORD s_irCache[IRSIZE];
Karsten Hopp 52b8c5
      static DWORD s_dwIndex = 0;
Karsten Hopp 52b8c5
      static DWORD s_dwMax = 0;
Karsten Hopp 52b8c5
!     DWORD dwEvents;
Karsten Hopp 52b8c5
  
Karsten Hopp 52b8c5
      if (s_dwMax == 0)
Karsten Hopp 52b8c5
      {
Karsten Hopp 52b8c5
! 	if (nLength == -1)
Karsten Hopp 52b8c5
! 	    return PeekConsoleInput(hInput, lpBuffer, 1, lpEvents);
Karsten Hopp 52b8c5
! 	if (!ReadConsoleInput(hInput, s_irCache, IRSIZE, &dwEvents))
Karsten Hopp 52b8c5
! 	    return FALSE;
Karsten Hopp 52b8c5
  	s_dwIndex = 0;
Karsten Hopp 52b8c5
! 	s_dwMax = dwEvents;
Karsten Hopp 52b8c5
! 	if (dwEvents == 0)
Karsten Hopp 52b8c5
  	{
Karsten Hopp 52b8c5
! 	    *lpEvents = 0;
Karsten Hopp 52b8c5
! 	    return TRUE;
Karsten Hopp 52b8c5
  	}
Karsten Hopp 52b8c5
      }
Karsten Hopp 52b8c5
!     *lpBuffer = s_irCache[s_dwIndex];
Karsten Hopp 52b8c5
!     if (nLength != -1 && ++s_dwIndex >= s_dwMax)
Karsten Hopp 52b8c5
  	s_dwMax = 0;
Karsten Hopp 52b8c5
!     *lpEvents = 1;
Karsten Hopp 52b8c5
      return TRUE;
Karsten Hopp 52b8c5
  }
Karsten Hopp 52b8c5
  
Karsten Hopp 52b8c5
***************
Karsten Hopp 52b8c5
*** 292,304 ****
Karsten Hopp 52b8c5
   */
Karsten Hopp 52b8c5
      static BOOL
Karsten Hopp 52b8c5
  peek_console_input(
Karsten Hopp 52b8c5
!     HANDLE hConsoleInput,
Karsten Hopp 52b8c5
!     PINPUT_RECORD lpBuffer,
Karsten Hopp 52b8c5
!     DWORD nLength,
Karsten Hopp 52b8c5
!     LPDWORD lpNumberOfEventsRead)
Karsten Hopp 52b8c5
  {
Karsten Hopp 52b8c5
!     return read_console_input(hConsoleInput, lpBuffer, -1,
Karsten Hopp 52b8c5
! 							lpNumberOfEventsRead);
Karsten Hopp 52b8c5
  }
Karsten Hopp 52b8c5
  
Karsten Hopp 52b8c5
      static void
Karsten Hopp 52b8c5
--- 278,289 ----
Karsten Hopp 52b8c5
   */
Karsten Hopp 52b8c5
      static BOOL
Karsten Hopp 52b8c5
  peek_console_input(
Karsten Hopp 52b8c5
!     HANDLE	    hInput,
Karsten Hopp 52b8c5
!     INPUT_RECORD    *lpBuffer,
Karsten Hopp 52b8c5
!     DWORD	    nLength,
Karsten Hopp 52b8c5
!     LPDWORD	    lpEvents)
Karsten Hopp 52b8c5
  {
Karsten Hopp 52b8c5
!     return read_console_input(hInput, lpBuffer, -1, lpEvents);
Karsten Hopp 52b8c5
  }
Karsten Hopp 52b8c5
  
Karsten Hopp 52b8c5
      static void
Karsten Hopp 52b8c5
***************
Karsten Hopp 52b8c5
*** 585,594 ****
Karsten Hopp 52b8c5
      static BOOL
Karsten Hopp 52b8c5
  win32_enable_privilege(LPTSTR lpszPrivilege, BOOL bEnable)
Karsten Hopp 52b8c5
  {
Karsten Hopp 52b8c5
!     BOOL             bResult;
Karsten Hopp 52b8c5
!     LUID             luid;
Karsten Hopp 52b8c5
!     HANDLE           hToken;
Karsten Hopp 52b8c5
!     TOKEN_PRIVILEGES tokenPrivileges;
Karsten Hopp 52b8c5
  
Karsten Hopp 52b8c5
      if (!OpenProcessToken(GetCurrentProcess(),
Karsten Hopp 52b8c5
  		TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken))
Karsten Hopp 52b8c5
--- 570,579 ----
Karsten Hopp 52b8c5
      static BOOL
Karsten Hopp 52b8c5
  win32_enable_privilege(LPTSTR lpszPrivilege, BOOL bEnable)
Karsten Hopp 52b8c5
  {
Karsten Hopp 52b8c5
!     BOOL		bResult;
Karsten Hopp 52b8c5
!     LUID		luid;
Karsten Hopp 52b8c5
!     HANDLE		hToken;
Karsten Hopp 52b8c5
!     TOKEN_PRIVILEGES	tokenPrivileges;
Karsten Hopp 52b8c5
  
Karsten Hopp 52b8c5
      if (!OpenProcessToken(GetCurrentProcess(),
Karsten Hopp 52b8c5
  		TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken))
Karsten Hopp 52b8c5
*** ../vim-7.4.141/src/version.c	2014-01-10 18:16:00.000000000 +0100
Karsten Hopp 52b8c5
--- src/version.c	2014-01-12 13:17:47.000000000 +0100
Karsten Hopp 52b8c5
***************
Karsten Hopp 52b8c5
*** 740,741 ****
Karsten Hopp 52b8c5
--- 740,743 ----
Karsten Hopp 52b8c5
  {   /* Add new patch number below this line */
Karsten Hopp 52b8c5
+ /**/
Karsten Hopp 52b8c5
+     142,
Karsten Hopp 52b8c5
  /**/
Karsten Hopp 52b8c5
Karsten Hopp 52b8c5
-- 
Karsten Hopp 52b8c5
Drink wet cement and get really stoned.
Karsten Hopp 52b8c5
Karsten Hopp 52b8c5
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 52b8c5
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 52b8c5
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp 52b8c5
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///