[patch] terminal: Read modifiers from the first UTF-8 byte, not the last.

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
(unnamed) (text/x-patch, 2 KB)
terminal: Read modifiers from the first UTF-8 byte, not the last.

Previously, ELinks used to silently discard the Alt modifier from
Alt-ö keystrokes when UTF-8 I/O was enabled.  Now, separate actions
can be bound to ö and Alt-ö.

However, if CONFIG_UTF_8 is defined and the UTF-8 charset is selected,
then actions cannot be bound to non-ASCII characters, regardless of
modifiers.  This is because ELinks then treats each byte as a separate
keyboard event.  This commit does not change that.

---
commit eeb3a6f5820c45fb5a1c3e8869bc4888900059f6
tree 1412dc1c238cd3b1898744a4e9ab496957eece27
parent 73eb3d5228d2c0150f78858bc7d36327eb7c3f98
author Kalle Olavi Niemitalo <[email protected]> Sun, 30 Jul 2006 16:35:56 +0300
committer Kalle Olavi Niemitalo <[email protected]> Sun, 30 Jul 2006 16:35:56 +0300

 src/terminal/event.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/src/terminal/event.c b/src/terminal/event.c
index f70854a..291d3ef 100644
--- a/src/terminal/event.c
+++ b/src/terminal/event.c
@@ -44,6 +44,12 @@ struct terminal_interlink {
 		unicode_val_T ucs;
 		int len;
 		int min;
+		/* Modifier keys from the key event that carried the
+		 * first byte of the character.  We need this because
+		 * ELinks sees e.g. ESC U+00F6 as 0x1B 0xC3 0xB6 and
+		 * converts it to Alt-0xC3 0xB6, attaching the
+		 * modifier to the first byte only.  */
+		int modifier;
 	} utf_8;
 
 	/* This is the queue of events as coming from the other ELinks instance
@@ -134,6 +140,7 @@ term_send_ucs(struct terminal *term, str
 	recoded = u2cp_no_nbsp(u, get_opt_codepage_tree(term->spec, "charset"));
 	if (!recoded) recoded = "*";
 	while (*recoded) {
+		ev->info.keyboard.modifier = term->interlink->utf_8.modifier;
 		ev->info.keyboard.key = *recoded;
 		term_send_event(term, ev);
 		recoded++;
@@ -306,6 +313,7 @@ #endif /* CONFIG_UTF_8 */
 
 			interlink->utf_8.len = len - 1;
 			interlink->utf_8.ucs = key & (mask - 1);
+			interlink->utf_8.modifier = get_kbd_modifier(ev);
 			break;
 		}
signature.asc (application/pgp-signature, 188 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)

iD8DBQFEzLaxHm9IGt60eMgRApqxAJ9cFB4zfGBVydlUYynQxPKOy+K+8gCg1inm
Vs1RdT5wBFSA7xcFAzqsFxs=
=JodF
-----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.