]> granicus.if.org Git - vim/commitdiff
updated for version 7.1-158 v7.1.158
authorBram Moolenaar <Bram@vim.org>
Tue, 20 Nov 2007 16:22:16 +0000 (16:22 +0000)
committerBram Moolenaar <Bram@vim.org>
Tue, 20 Nov 2007 16:22:16 +0000 (16:22 +0000)
src/gui_w48.c
src/os_win32.c
src/version.c

index cfbbbc00b4c025bffe317c130fd863a91601cc5e..42cf91fd6ed6551770e0bff9b8943317b947b468 100644 (file)
@@ -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;
index 960943c947cd639b1a9dceb3ee45f43c4886085b..b0502b26b5d9e7fc650cdd56fbd1cf09210150d6 100644 (file)
@@ -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;
                }
 
index 2e300f5a8d8fd66801691df897ad93b8d33da563..3661a8bebedb79d87cf61cc385bd392ad3ceef53 100644 (file)
@@ -666,6 +666,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    158,
 /**/
     157,
 /**/