0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

updated for version 7.1-158

This commit is contained in:
Bram Moolenaar
2007-11-20 16:22:16 +00:00
parent f998c04691
commit 85a3e5c7c6
3 changed files with 26 additions and 4 deletions

View 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;

View 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;
}

View File

@@ -666,6 +666,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
158,
/**/
157,
/**/