From 3d9d7a9b30275a9569d2a25b0fd0194e2b378c71 Mon Sep 17 00:00:00 2001 From: Gerd Moellmann Date: Mon, 28 May 2001 16:21:41 +0000 Subject: [PATCH] (Fsingle_key_description): Create a multibyte string only if necessary. --- src/ChangeLog | 7 +++++++ src/keymap.c | 20 ++++++++++++-------- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 2bf591053df..32b377031a2 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,12 @@ 2001-05-28 Gerd Moellmann + * xmenu.c (xmenu_show) [!HAVE_MULTILINGUAL_MENU]: Don't overwrite + an item's name with its key description in case the description + is a multibyte string. + + * keymap.c (Fsingle_key_description): Create a multibyte string + only if necessary. + * macros.c (Fstart_kbd_macro): Doc fix. * xterm.c (cursor_in_mouse_face_p): New function. diff --git a/src/keymap.c b/src/keymap.c index a1f0de1c09a..f96c109c9cd 100644 --- a/src/keymap.c +++ b/src/keymap.c @@ -1959,14 +1959,18 @@ around function keys and event symbols.") } else { - char tem[KEY_DESCRIPTION_SIZE]; - int len; - - *push_key_description (XUINT (key), tem, 1) = 0; - len = strlen (tem); - return make_multibyte_string (tem, - multibyte_chars_in_text (tem, len), - len); + char tem[KEY_DESCRIPTION_SIZE], *end; + int nbytes, nchars; + Lisp_Object string; + + end = push_key_description (XUINT (key), tem, 1); + nbytes = end - tem; + nchars = multibyte_chars_in_text (tem, nbytes); + if (nchars == nbytes) + string = build_string (tem); + else + string = make_multibyte_string (tem, nchars, nbytes); + return string; } } else if (SYMBOLP (key)) /* Function key or event-symbol */ -- 2.39.5