jkunstle / rpms / vim

Forked from rpms/vim 3 years ago
Clone

Blame SOURCES/7.4.142

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