summaryrefslogtreecommitdiffstats
path: root/patches/source/vim/patches/7.4.142
blob: 0e4f8f07d2a58bbc75dfe16ea2bd3a2e5d481395 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
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


*** ../vim-7.4.141/src/os_win32.c	2014-01-10 18:16:00.000000000 +0100
--- src/os_win32.c	2014-01-12 13:23:24.000000000 +0100
***************
*** 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))
*** ../vim-7.4.141/src/version.c	2014-01-10 18:16:00.000000000 +0100
--- src/version.c	2014-01-12 13:17:47.000000000 +0100
***************
*** 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    ///