Mercurial > hg > xemacs-beta
diff src/console-x.c @ 3142:77f5a5135b3a
[xemacs-hg @ 2005-12-17 19:46:57 by aidan]
Fix self-insert-command with X11 input methods. Addresses Zhang Wei's
problem of 871x118lc4.fsf@gmail.com.
author | aidan |
---|---|
date | Sat, 17 Dec 2005 19:47:03 +0000 |
parents | c1ec282bb160 |
children | 374186f156d5 |
line wrap: on
line diff
--- a/src/console-x.c Fri Dec 16 23:52:23 2005 +0000 +++ b/src/console-x.c Sat Dec 17 19:47:03 2005 +0000 @@ -349,6 +349,26 @@ xkeysym = XStringToKeysym(keysym_ext); if (NoSymbol == xkeysym) { + /* Keysym is NoSymbol; this may mean the key event passed to us came + from an input method, which stored the actual character intended to + be inserted in the key name, and didn't trouble itself to set the + keycode to anything useful. Thus, if the key name is a single + character, and the keysym is NoSymbol, give it a default binding, + if that is possible. */ + Lisp_Object keychar; + + if (1 != string_char_length(key_name)) + { + /* Don't let them pass us more than one character. */ + return Qnil; + } + keychar = make_char(itext_ichar(XSTRING_DATA(key_name))); + if (NILP (Flookup_key (Vcurrent_global_map, keychar, Qnil))) + { + Fdefine_key (Vcurrent_global_map, keychar, Qself_insert_command); + Fputhash (keychar, Qt, DEVICE_X_KEYSYM_MAP_HASH_TABLE (d)); + return Qt; + } return Qnil; }