| To: vim_dev@googlegroups.com |
| Subject: Patch 7.4.142 |
| 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.142 (after 7.4.137) |
| Problem: On MS-Windows 8 IME input doen't work correctly. |
| Solution: Work around the problem. (Nobuhiro Takasaki) |
| Files: src/os_win32.c |
| |
| |
| |
| |
| |
| *** 234,289 **** |
| |
| /* |
| * Version of ReadConsoleInput() that works with IME. |
| */ |
| static BOOL |
| read_console_input( |
| ! HANDLE hConsoleInput, |
| ! PINPUT_RECORD lpBuffer, |
| ! DWORD nLength, |
| ! LPDWORD lpNumberOfEventsRead) |
| { |
| enum |
| { |
| ! IRSIZE = 10, /* rough value */ |
| }; |
| ! static INPUT_RECORD irCache[IRSIZE]; |
| static DWORD s_dwIndex = 0; |
| static DWORD s_dwMax = 0; |
| ! |
| ! if (hConsoleInput == NULL || lpBuffer == NULL) |
| ! return ReadConsoleInput(hConsoleInput, lpBuffer, nLength, |
| ! lpNumberOfEventsRead); |
| ! |
| ! if (nLength == -1) |
| ! { |
| ! if (s_dwMax == 0) |
| ! { |
| ! PeekConsoleInput(hConsoleInput, lpBuffer, 1, lpNumberOfEventsRead); |
| ! if (*lpNumberOfEventsRead == 0) |
| ! return FALSE; |
| ! ReadConsoleInput(hConsoleInput, irCache, IRSIZE, &s_dwMax); |
| ! s_dwIndex = 0; |
| ! } |
| ! ((PINPUT_RECORD)lpBuffer)[0] = irCache[s_dwIndex]; |
| ! *lpNumberOfEventsRead = 1; |
| ! return TRUE; |
| ! } |
| |
| if (s_dwMax == 0) |
| { |
| ! ReadConsoleInput(hConsoleInput, irCache, IRSIZE, &s_dwMax); |
| s_dwIndex = 0; |
| ! if (s_dwMax == 0) |
| { |
| ! *lpNumberOfEventsRead = 0; |
| ! return FALSE; |
| } |
| } |
| ! |
| ! ((PINPUT_RECORD)lpBuffer)[0] = irCache[s_dwIndex]; |
| ! if (++s_dwIndex == s_dwMax) |
| s_dwMax = 0; |
| ! *lpNumberOfEventsRead = 1; |
| return TRUE; |
| } |
| |
| --- 234,275 ---- |
| |
| /* |
| * Version of ReadConsoleInput() that works with IME. |
| + * Works around problems on Windows 8. |
| */ |
| static BOOL |
| read_console_input( |
| ! HANDLE hInput, |
| ! INPUT_RECORD *lpBuffer, |
| ! DWORD nLength, |
| ! LPDWORD lpEvents) |
| { |
| enum |
| { |
| ! IRSIZE = 10 |
| }; |
| ! static INPUT_RECORD s_irCache[IRSIZE]; |
| static DWORD s_dwIndex = 0; |
| static DWORD s_dwMax = 0; |
| ! DWORD dwEvents; |
| |
| if (s_dwMax == 0) |
| { |
| ! if (nLength == -1) |
| ! return PeekConsoleInput(hInput, lpBuffer, 1, lpEvents); |
| ! if (!ReadConsoleInput(hInput, s_irCache, IRSIZE, &dwEvents)) |
| ! return FALSE; |
| s_dwIndex = 0; |
| ! s_dwMax = dwEvents; |
| ! if (dwEvents == 0) |
| { |
| ! *lpEvents = 0; |
| ! return TRUE; |
| } |
| } |
| ! *lpBuffer = s_irCache[s_dwIndex]; |
| ! if (nLength != -1 && ++s_dwIndex >= s_dwMax) |
| s_dwMax = 0; |
| ! *lpEvents = 1; |
| return TRUE; |
| } |
| |
| |
| *** 292,304 **** |
| */ |
| static BOOL |
| peek_console_input( |
| ! HANDLE hConsoleInput, |
| ! PINPUT_RECORD lpBuffer, |
| ! DWORD nLength, |
| ! LPDWORD lpNumberOfEventsRead) |
| { |
| ! return read_console_input(hConsoleInput, lpBuffer, -1, |
| ! lpNumberOfEventsRead); |
| } |
| |
| static void |
| --- 278,289 ---- |
| */ |
| static BOOL |
| peek_console_input( |
| ! HANDLE hInput, |
| ! INPUT_RECORD *lpBuffer, |
| ! DWORD nLength, |
| ! LPDWORD lpEvents) |
| { |
| ! return read_console_input(hInput, lpBuffer, -1, lpEvents); |
| } |
| |
| static void |
| |
| *** 585,594 **** |
| static BOOL |
| win32_enable_privilege(LPTSTR lpszPrivilege, BOOL bEnable) |
| { |
| ! BOOL bResult; |
| ! LUID luid; |
| ! HANDLE hToken; |
| ! TOKEN_PRIVILEGES tokenPrivileges; |
| |
| if (!OpenProcessToken(GetCurrentProcess(), |
| TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken)) |
| --- 570,579 ---- |
| static BOOL |
| win32_enable_privilege(LPTSTR lpszPrivilege, BOOL bEnable) |
| { |
| ! BOOL bResult; |
| ! LUID luid; |
| ! HANDLE hToken; |
| ! TOKEN_PRIVILEGES tokenPrivileges; |
| |
| if (!OpenProcessToken(GetCurrentProcess(), |
| TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken)) |
| |
| |
| |
| *** 740,741 **** |
| --- 740,743 ---- |
| { /* Add new patch number below this line */ |
| + /**/ |
| + 142, |
| /**/ |
| |
| -- |
| Drink wet cement and get really stoned. |
| |
| /// 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 /// |