1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

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.
This commit is contained in:
Kalle Olavi Niemitalo 2006-08-05 11:08:48 +03:00 committed by Miciah Dashiel Butler Masters
parent 9e30ee631c
commit 51bc99a175

View File

@ -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;
}