summaryrefslogtreecommitdiff
path: root/src/keymap.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/keymap.c')
-rw-r--r--src/keymap.c20
1 files changed, 12 insertions, 8 deletions
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 */