core: send signal "key_pressed" for mouse code only if the string is UTF-8 valid (closes #1220)

v2.8-utf8proc
Sébastien Helleu 2018-07-15 15:09:31 +02:00
parent 738585d9e2
commit df27a3b76a
2 changed files with 17 additions and 2 deletions

View File

@ -15,6 +15,13 @@ https://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes]
(file _ReleaseNotes.adoc_ in sources).
[[v2.3]]
== Version 2.3 (under dev)
Bug fixes::
* core: send signal "key_pressed" for mouse code only if the string is UTF-8 valid (issue #1220)
[[v2.2]]
== Version 2.2 (2018-07-14)

View File

@ -408,8 +408,16 @@ gui_key_flush (int paste)
if (key_str[0])
{
(void) hook_signal_send ("key_pressed",
WEECHAT_HOOK_SIGNAL_STRING, key_str);
/*
* send the signal "key_pressed" only if NOT reading a mouse event
* or if the mouse code is valid UTF-8 (do not send partial mouse
* code which is not UTF-8 valid)
*/
if (!gui_mouse_event_pending || utf8_is_valid (key_str, -1, NULL))
{
(void) hook_signal_send ("key_pressed",
WEECHAT_HOOK_SIGNAL_STRING, key_str);
}
if (gui_current_window->buffer->text_search != GUI_TEXT_SEARCH_DISABLED)
input_old = (gui_current_window->buffer->input_buffer) ?