From 51bc99a17560d227cba1c41f4c9d0f480e94dcb4 Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Sat, 5 Aug 2006 11:08:48 +0300 Subject: [PATCH] terminal: decode_terminal_escape_sequence ignores previous value of *ev. There is no need to check whether ev->ev == EVENT_KBD; if decode_terminal_escape_sequence called decode_terminal_mouse_escape_sequence, then the former neither modified kbd.key nor passed &kbd to the latter, so kbd.key remains KBD_UNDEF. If ev->ev was not checked, then it should not be trusted either. So reinitialize the whole *ev if a keyboard event was indeed found. --- src/terminal/kbd.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/terminal/kbd.c b/src/terminal/kbd.c index 84a8d0259..6aeb297db 100644 --- a/src/terminal/kbd.c +++ b/src/terminal/kbd.c @@ -770,10 +770,9 @@ decode_terminal_escape_sequence(struct itrm *itrm, struct term_event *ev) break; } - /* The event might have been changed to a mouse event */ - if (ev->ev == EVENT_KBD && kbd.key != KBD_UNDEF) { - copy_struct(&ev->info.keyboard, &kbd); - } + /* KBD_UNDEF here means it was unrecognized or a mouse event. */ + if (kbd.key != KBD_UNDEF) + set_kbd_term_event(ev, kbd.key, kbd.modifier); return el; }