devin@lucid.com (Matthieu Devin) (03/30/89)
After hours trying to understand what's going on with translations, I give up and request Experts' magic.. I put the following translations inside my .Xdefaults file: xedit*Text.translations:\ :Ctrl<Key>d: delete-next-character() \n\ :Meta<Key>d: kill-word() \n\ :<Key>Escape,:<Key>d: delete-next-word() \n\ :<Key>: insert-char() this should associate actions with control-d, meta-d, the sequence Escape d, and the lonely key d. If you try it you won't get any actions for d, although the 3 other ones work. I must be missing something trivial here, but from reading the doc I can't find what. Can someone help me? Thanks in advance Matth Oops I almost forgot: Sun 3/160, OS 3.2, GCC, Monochrome, TWM, Fixes 1-8, Purdue 1 & 3. -- Matthieu Devin Lucid Inc, 707 Laurel Street, Menlo Park, CA 94025 devin@lucid.com (415)329-8400 x 5574
devin@LUCID.COM (Matthieu Devin) (03/31/89)
>> I put the following translations inside my .Xdefaults file: >> >> xedit*Text.translations:\ >> :Ctrl<Key>d: delete-next-character() \n\ >> :Meta<Key>d: kill-word() \n\ >> :<Key>Escape,:<Key>d: delete-next-word() \n\ >> :<Key>: insert-char() >> >I think you need to say which key on the last one. > :<Key>d:insert-char() In fact it is even easier to break. I think (hoping I'm wrong) that the event-sequence mechanism is somewhat buggy. If I put the following translaytions in my .Xdefaults, I will loose the d key when not preceded by the a key: xedit*Text.translations:\ <Key>a,<Key>d: insert-char() \n\ <Key>: insert-char() \n\ If I add a specific translation for d everything works (this could be considered a turn around): xedit*Text.translations:\ <Key>a,<Key>d: insert-char() \n\ <Key>d: insert-char() \n\ <Key>: insert-char() But I don't want to add a translation for every possible key I want to use preceded by an other one. Consider the following case (which leaded me to this bug): xedit*Text.translations:\ <Key>Escape,<Key>a: do-a-command() \n\ <Key>Escape,<Key>b: do-another-command() \n\ ...etc... <Key>Escape,<Key>: ring-the-bell() \n\ <Key>: insert-char() I understood that this would bind some escape-sequences to some commands and that other escape sequences would ring a bell. But with the preceding bug (?) the translation: <Key>Escape,<Key>: ring-the-bell() \n\ Catches all the keys, not only the one preceded by an Escape. So I loose everything there. The turn around would be to add translations for every possible key... how sad... Matth -- Matthieu Devin Lucid Inc, 707 Laurel Street, Menlo Park, CA 94025 devin@lucid.com (415)329-8400 x 5574
kit@ATHENA.MIT.EDU (Chris D. Peterson) (03/31/89)
[ Donna Converse writes:] > >I think you need to say which key on the last one. > > :<Key>d:insert-char() [ Matt Devin replies] > In fact it is even easier to break. I think (hoping I'm wrong) that the > event-sequence mechanism is somewhat buggy. There is some good news and bad news here. The good news is that the current MIT implemention seems to match the specification which states that this type if thing will work: xedit*Text.translations: #override \n\ <event1>, <event2>: <action1> \n\ <event3>: <action2> If Event2 is exactly the same as Event3 then the specification is very clear about what happens. If event2 is immediately preceeded by event1 then action1 will be used. If event2 is not immediately preceeded by event1 then action2 will be used. Now the bad news... The specification says nothing about what happens if event3 is a more general case of event2, as in the example given when event2 is "<Key>d" and event3 is "<Key>". What is currently happening is that action2 is never executed on an event2 that is not immediately preceeded by event1. It seems that this is not so much a bug as a case that was overlooked by the Xt specification. Getting this changed will probabally require a formal change to the specification. Chris D. Peterson MIT X Consortium / Project Athena Net: kit@athena.mit.edu Phone: (617) 253 - 1326 USMail: MIT - Room E40-321 77 Massachusetts Ave. Cambridge, MA 02139