[patch 03/11] terminal: decode_terminal_escape_sequence ignores previous value of *ev.

Kalle Olavi Niemitalo <[email protected]>
Newsgroups gmane.comp.web.links
Message-ID <[email protected]>
_______________________________________________
elinks-dev mailing list
[email protected]
http://linuxfromscratch.org/mailman/listinfo/elinks-dev
03 (text/x-patch, 1.3 KB)
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.

---
commit 637a41b0a4f69328e4acd6bef723966d44cf2ffa
tree a73ec568f40c5a0faf8b7674af34ec6c3871ef69
parent 129c5bb4dcafbfcf62d75c3e02db45699fb56536
author Kalle Olavi Niemitalo <[email protected]> Sat, 05 Aug 2006 11:08:48 +0300
committer Kalle Olavi Niemitalo <[email protected]> Sat, 05 Aug 2006 20:00:28 +0300

 src/terminal/kbd.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/terminal/kbd.c b/src/terminal/kbd.c
index 84a8d02..6aeb297 100644
--- a/src/terminal/kbd.c
+++ b/src/terminal/kbd.c
@@ -770,10 +770,9 @@ #endif /* CONFIG_MOUSE */
 		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;
 }
signature.asc (application/pgp-signature, 188 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)

iD8DBQFE1N7zHm9IGt60eMgRAleXAJ90ijJTaO1dToQDmOtcSwSnvkxanwCcCa/4
0QOBZptxGpe8q+kp0uXG6k4=
=8avz
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.