mirror of
https://github.com/weechat/weechat.git
synced 2026-07-07 02:03:13 +02:00
core: don't send key_pressed signal again for the same key press
If you press an incomplete key sequence, previously WeeChat would send the key_pressed signal again for the same keys on the next key. E.g. if you press escape and then 1, previously you would get the key_pressed signal with signal_data `\x01[` when you pressed escape, and then key_pressed with `\x01[` again when you pressed 1 (plus key_pressed with `1` for the 1 key). So two signals for the escape key, even though it was only pressed once. With this patch, you only get one signal for each key press. So one with `\x01[` when you press escape and then one with `1` when you press 1.
This commit is contained in:
committed by
Sébastien Helleu
parent
824cfb6427
commit
3247974eb4
@@ -396,12 +396,13 @@ gui_key_flush (int paste)
|
||||
* or if the mouse code is valid UTF-8 (do not send partial mouse
|
||||
* code which is not UTF-8 valid)
|
||||
*/
|
||||
if (!paste
|
||||
if (!paste && i > gui_key_last_key_pressed_sent
|
||||
&& (!gui_mouse_event_pending
|
||||
|| utf8_is_valid (key_str, -1, NULL)))
|
||||
{
|
||||
(void) hook_signal_send ("key_pressed",
|
||||
WEECHAT_HOOK_SIGNAL_STRING, key_str);
|
||||
gui_key_last_key_pressed_sent = i;
|
||||
}
|
||||
|
||||
if (gui_current_window->buffer->text_search != GUI_TEXT_SEARCH_DISABLED)
|
||||
|
||||
Reference in New Issue
Block a user