From 85a3e5c7c61c43ffda9645019b724837890a7e8a Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Tue, 20 Nov 2007 16:22:16 +0000 Subject: updated for version 7.1-158 --- src/gui_w48.c | 23 +++++++++++++++++++---- src/os_win32.c | 5 +++++ src/version.c | 2 ++ 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/src/gui_w48.c b/src/gui_w48.c index cfbbbc00b..42cf91fd6 100644 --- a/src/gui_w48.c +++ b/src/gui_w48.c @@ -486,10 +486,11 @@ _OnDeadChar( /* * Convert Unicode character "ch" to bytes in "string[slen]". + * When "had_alt" is TRUE the ALT key was included in "ch". * Return the length. */ static int -char_to_string(int ch, char_u *string, int slen) +char_to_string(int ch, char_u *string, int slen, int had_alt) { int len; int i; @@ -522,8 +523,22 @@ char_to_string(int ch, char_u *string, int slen) * "enc_codepage" is non-zero use the standard Win32 function, * otherwise use our own conversion function (e.g., for UTF-8). */ if (enc_codepage > 0) + { len = WideCharToMultiByte(enc_codepage, 0, wstring, len, string, slen, 0, NULL); + /* If we had included the ALT key into the character but now the + * upper bit is no longer set, that probably means the conversion + * failed. Convert the original character and set the upper bit + * afterwards. */ + if (had_alt && len == 1 && ch >= 0x80 && string[0] < 0x80) + { + wstring[0] = ch & 0x7f; + len = WideCharToMultiByte(enc_codepage, 0, wstring, len, + string, slen, 0, NULL); + if (len == 1) /* safety check */ + string[0] |= 0x80; + } + } else { len = 1; @@ -573,7 +588,7 @@ _OnChar( char_u string[40]; int len = 0; - len = char_to_string(ch, string, 40); + len = char_to_string(ch, string, 40, FALSE); if (len == 1 && string[0] == Ctrl_C && ctrl_c_interrupts) { trash_input_buf(); @@ -640,7 +655,7 @@ _OnSysChar( { /* Although the documentation isn't clear about it, we assume "ch" is * a Unicode character. */ - len += char_to_string(ch, string + len, 40 - len); + len += char_to_string(ch, string + len, 40 - len, TRUE); } add_to_input_buf(string, len); @@ -1775,7 +1790,7 @@ process_message(void) int len; /* Handle "key" as a Unicode character. */ - len = char_to_string(key, string, 40); + len = char_to_string(key, string, 40, FALSE); add_to_input_buf(string, len); } break; diff --git a/src/os_win32.c b/src/os_win32.c index 960943c94..b0502b26b 100644 --- a/src/os_win32.c +++ b/src/os_win32.c @@ -1521,7 +1521,12 @@ mch_inchar( #endif ) { +#ifdef FEAT_MBYTE + n = (*mb_char2bytes)(typeahead[typeaheadlen] | 0x80, + typeahead + typeaheadlen); +#else typeahead[typeaheadlen] |= 0x80; +#endif modifiers &= ~MOD_MASK_ALT; } diff --git a/src/version.c b/src/version.c index 2e300f5a8..3661a8beb 100644 --- a/src/version.c +++ b/src/version.c @@ -666,6 +666,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 158, /**/ 157, /**/ -- cgit v1.2.1