2 Subject: Patch 7.1.158 (extra)
4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=ISO-8859-1
7 Content-Transfer-Encoding: 8bit
11 Problem: Win32 console: When 'encoding' is "utf-8" and typing Alt-y the
12 result is wrong. Win32 GUI: Alt-y results in "u" when 'encoding'
13 is "cp1250" (Lukas Cerman)
14 Solution: For utf-8 don't set the 7th bit in a byte, convert to the correct
15 byte sequence. For cp1250, when conversion to 'encoding' results
16 in the 7th bit not set, set the 7th bit after conversion.
17 Files: src/os_win32.c, src/gui_w48.c
20 *** ../vim-7.1.157/src/os_win32.c Mon Oct 1 20:33:45 2007
21 --- src/os_win32.c Sat Oct 27 17:35:04 2007
29 + n = (*mb_char2bytes)(typeahead[typeaheadlen] | 0x80,
30 + typeahead + typeaheadlen);
32 typeahead[typeaheadlen] |= 0x80;
34 modifiers &= ~MOD_MASK_ALT;
37 *** ../vim-7.1.157/src/gui_w48.c Sun Sep 30 14:00:41 2007
38 --- src/gui_w48.c Mon Oct 29 20:00:25 2007
43 * Convert Unicode character "ch" to bytes in "string[slen]".
47 ! char_to_string(int ch, char_u *string, int slen)
54 * Convert Unicode character "ch" to bytes in "string[slen]".
55 + * When "had_alt" is TRUE the ALT key was included in "ch".
59 ! char_to_string(int ch, char_u *string, int slen, int had_alt)
66 * "enc_codepage" is non-zero use the standard Win32 function,
67 * otherwise use our own conversion function (e.g., for UTF-8). */
70 len = WideCharToMultiByte(enc_codepage, 0, wstring, len,
71 string, slen, 0, NULL);
72 + /* If we had included the ALT key into the character but now the
73 + * upper bit is no longer set, that probably means the conversion
74 + * failed. Convert the original character and set the upper bit
76 + if (had_alt && len == 1 && ch >= 0x80 && string[0] < 0x80)
78 + wstring[0] = ch & 0x7f;
79 + len = WideCharToMultiByte(enc_codepage, 0, wstring, len,
80 + string, slen, 0, NULL);
81 + if (len == 1) /* safety check */
93 ! len = char_to_string(ch, string, 40);
94 if (len == 1 && string[0] == Ctrl_C && ctrl_c_interrupts)
101 ! len = char_to_string(ch, string, 40, FALSE);
102 if (len == 1 && string[0] == Ctrl_C && ctrl_c_interrupts)
108 /* Although the documentation isn't clear about it, we assume "ch" is
109 * a Unicode character. */
110 ! len += char_to_string(ch, string + len, 40 - len);
113 add_to_input_buf(string, len);
116 /* Although the documentation isn't clear about it, we assume "ch" is
117 * a Unicode character. */
118 ! len += char_to_string(ch, string + len, 40 - len, TRUE);
121 add_to_input_buf(string, len);
126 /* Handle "key" as a Unicode character. */
127 ! len = char_to_string(key, string, 40);
128 add_to_input_buf(string, len);
134 /* Handle "key" as a Unicode character. */
135 ! len = char_to_string(key, string, 40, FALSE);
136 add_to_input_buf(string, len);
139 *** ../vim-7.1.157/src/version.c Tue Nov 20 12:30:31 2007
140 --- src/version.c Tue Nov 20 17:19:18 2007
144 { /* Add new patch number below this line */
150 hundred-and-one symptoms of being an internet addict:
151 123. You ask the car dealer to install an extra cigarette lighter
152 on your new car to power your notebook.
154 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
155 /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
156 \\\ download, build and distribute -- http://www.A-A-P.org ///
157 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///