Can people try the below patch ? I'm interested in any failures. I've changed things so that if we really don't recognise what's going on, but the toolkit thinks it has some real key to insert, we do so. Now that's pretty uncontroversial I would think. Note we only do this if we're at the start of a key-sequence (M-p S-3 should not insert a sterling sign).
The second part of this patch (in fact related to the above too, but ..) is sure to open up an old wound. I have removed that horrible remove-modifiers hack. I agree 100% with JMarc that it's a terrible idea, and it actually actively breaks on Qt. Control-shift-k will end up inserting ^K with the hack - imagine the poor user trying to find the 2-pixels wide blank character in the document that breaks latex altogether ! Here is one thread discussing this : http://marc.theaimsgroup.com/?l=lyx-devel&m=102748015225296&w=2 Lars, can you please explain in more detail your problem with JMarc's ~S solution ? You already admit to agreeing a "tiny bit". I believe this means you know you are wrong :))) This is a long-time UI bug and it is time it was fixed. JMarc, what bindings are problematic these days ? Comments/flames welcome regards john Index: lyxfunc.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxfunc.C,v retrieving revision 1.385 diff -u -r1.385 lyxfunc.C --- lyxfunc.C 27 Nov 2002 10:30:10 -0000 1.385 +++ lyxfunc.C 5 Dec 2002 22:26:58 -0000 @@ -214,16 +214,12 @@ owner->message(keyseq.print()); } + if (action == LFUN_UNKNOWN_ACTION) { - // It is unknown, but what if we remove all - // the modifiers? (Lgb) - action = keyseq.addkey(keysym, key_modifier::none); - - lyxerr[Debug::KEY] << "Removing modifiers...\n" - << "Action now set to [" - << action << ']' << endl; - - if (action == LFUN_UNKNOWN_ACTION) { + // if the key is still not recognised, see if it's printable + if (keysym->isText() && keyseq.length() == 1) { + action = LFUN_SELFINSERT; + } else { owner->message(_("Unknown function.")); return; } @@ -233,6 +229,7 @@ char c = keysym->getISOEncoded(); string argument; + // FIXME: why ... if (c != 0) argument = c; Index: frontends/LyXKeySym.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/LyXKeySym.h,v retrieving revision 1.6 diff -u -r1.6 LyXKeySym.h --- frontends/LyXKeySym.h 21 Oct 2002 14:58:58 -0000 1.6 +++ frontends/LyXKeySym.h 5 Dec 2002 22:26:58 -0000 @@ -36,6 +36,9 @@ /// Is this a modifier key only? virtual bool isModifier() const = 0; + /// Is this normal insertable text ? (last ditch attempt only) + virtual bool isText() const { return false; } + /// What is the symbolic name of this key? F.ex. "Return" or "c" virtual string getSymbolName() const = 0; Index: frontends/qt2/QLyXKeySym.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/QLyXKeySym.h,v retrieving revision 1.8 diff -u -r1.8 QLyXKeySym.h --- frontends/qt2/QLyXKeySym.h 20 Oct 2002 01:48:27 -0000 1.8 +++ frontends/qt2/QLyXKeySym.h 5 Dec 2002 22:26:58 -0000 @@ -50,6 +50,9 @@ /// return the LyX symbolic name virtual string getSymbolName() const; + /// Is this normal insertable text ? (last ditch attempt only) + virtual bool isText() const; + /** * Return the value of the keysym into the local ISO encoding. * This converts the LyXKeySym to a 8-bit encoded character. Index: frontends/qt2/QLyXKeySym.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/QLyXKeySym.C,v retrieving revision 1.11 diff -u -r1.11 QLyXKeySym.C --- frontends/qt2/QLyXKeySym.C 4 Dec 2002 17:40:16 -0000 1.11 +++ frontends/qt2/QLyXKeySym.C 5 Dec 2002 22:26:58 -0000 @@ -78,6 +78,18 @@ } +bool QLyXKeySym::isText() const +{ + if (text_.isEmpty()) + return false; + + QChar c(text_[0]); + lyxerr[Debug::KEY] << "isText for key " << key_ + << " isPrint is " << c.isPrint() << endl; + return c.isPrint(); +} + + bool operator==(LyXKeySym const & k1, LyXKeySym const & k2) { // note we ignore text_ here (non-strict ==), because -- "Yeah, I woke up in the day accidentally once, the moon was on fire for some reason and I couldn't see very well and all the bandwidth disappeared, it was very scary :(" - Orion