1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-27 10:54:40 +00:00

(push_key_description): Handle invalid character key.

This commit is contained in:
Kenichi Handa 2006-05-09 13:17:24 +00:00
parent c0b87c3fdb
commit f39a0b4301

View File

@ -2090,12 +2090,21 @@ push_key_description (c, p, force_multibyte)
int force_multibyte;
{
unsigned c2;
int valid_p;
/* Clear all the meaningless bits above the meta bit. */
c &= meta_modifier | ~ - meta_modifier;
c2 = c & ~(alt_modifier | ctrl_modifier | hyper_modifier
| meta_modifier | shift_modifier | super_modifier);
valid_p = SINGLE_BYTE_CHAR_P (c) || char_valid_p (c, 0);
if (! valid_p)
{
/* KEY_DESCRIPTION_SIZE is large enough for this. */
p += sprintf (p, "[%d]", c);
return p;
}
if (c & alt_modifier)
{
*p++ = 'A';
@ -2183,16 +2192,13 @@ push_key_description (c, p, force_multibyte)
}
else
{
int valid_p = SINGLE_BYTE_CHAR_P (c) || char_valid_p (c, 0);
if (force_multibyte && valid_p)
if (force_multibyte)
{
if (SINGLE_BYTE_CHAR_P (c))
c = unibyte_char_to_multibyte (c);
p += CHAR_STRING (c, p);
}
else if (NILP (current_buffer->enable_multibyte_characters)
|| valid_p)
else if (NILP (current_buffer->enable_multibyte_characters))
{
int bit_offset;
*p++ = '\\';