Avoid args-out-of-range errors on fringe clicks after "C-h k"

* src/keyboard.c (echo_truncate): Don't call Ftruncate if the echo
message is already shorter than NCHARS.  (Bug#27040)
This commit is contained in:
Eli Zaretskii 2017-05-27 15:57:38 +03:00
parent 4b17214aab
commit 3fc36f427a

View file

@ -634,7 +634,8 @@ echo_length (void)
static void
echo_truncate (ptrdiff_t nchars)
{
if (STRINGP (KVAR (current_kboard, echo_string)))
Lisp_Object es = KVAR (current_kboard, echo_string);
if (STRINGP (es) && SCHARS (es) > nchars)
kset_echo_string (current_kboard,
Fsubstring (KVAR (current_kboard, echo_string),
make_number (0), make_number (nchars)));