]> git.lyx.org Git - lyx.git/blobdiff - src/KeySequence.cpp
Fix text direction issue for InsetInfo in RTL context
[lyx.git] / src / KeySequence.cpp
index 5a7623b7f626fc86afb4c8f601596091525573f9..c80490f38fafa03f72f6a7183554157128a9bfed 100644 (file)
@@ -3,7 +3,7 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author Lars Gullik Bjønnes
+ * \author Lars Gullik Bjønnes
  * \author Jean-Marc Lasgouttes
  * \author John Levon
  *
@@ -40,8 +40,7 @@ FuncRequest const & KeySequence::addkey(KeySymbol const & key,
        if (curmap)
                return curmap->lookup(key, mod, this);
 
-       static FuncRequest unknown(LFUN_UNKNOWN_ACTION);
-       return unknown;
+       return FuncRequest::unknown;
 }
 
 
@@ -71,6 +70,12 @@ size_t KeySequence::parse(string const & s)
                                i += 2;
                                continue;
                        case 'm': case 'M':
+#if defined(USE_MACOSX_PACKAGING) || defined(USE_META_KEYBINDING)
+                               mod |= MetaModifier;
+                               i += 2;
+                               continue;
+#endif
+                       case 'a': case 'A':
                                mod |= AltModifier;
                                i += 2;
                                continue;
@@ -89,6 +94,12 @@ size_t KeySequence::parse(string const & s)
                                i += 3;
                                continue;
                        case 'm': case 'M':
+#if defined(USE_MACOSX_PACKAGING) || defined(USE_META_KEYBINDING)
+                               nmod |= MetaModifier;
+                               i += 3;
+                               continue;
+#endif
+                       case 'a': case 'A':
                                nmod |= AltModifier;
                                i += 3;
                                continue;
@@ -114,8 +125,7 @@ size_t KeySequence::parse(string const & s)
                }
        }
 
-       // empty sequence?
-       if (sequence.size() == 0)
+       if (sequence.empty())
                return 0;
 
        // everything is fine
@@ -142,10 +152,14 @@ docstring const KeySequence::print(outputFormat format) const
                        if (mod & ControlModifier)
                                buf += "C-";
                        if (mod & AltModifier)
+#if defined(USE_MACOSX_PACKAGING) || defined(USE_META_KEYBINDING)
+                               buf += "A-";
+                       if (mod & MetaModifier)
+#endif
                                buf += "M-";
                        if (mod & ShiftModifier)
                                buf += "S-";
-               
+
                        buf += from_utf8(sequence[i].getSymbolName());
                        break;
                }
@@ -170,15 +184,9 @@ docstring const KeySequence::printOptions(bool forgui) const
 }
 
 
-void KeySequence::mark_deleted()
-{
-       deleted_ = true;
-}
-
-
 void KeySequence::reset()
 {
-       mark_deleted();
+       deleted_ = true;
        curmap = stdmap;
 }
 
@@ -196,6 +204,8 @@ void KeySequence::removeKey()
                return;
        sequence.pop_back();
        modifiers.pop_back();
+       if (sequence.empty())
+               deleted_ = true;
 }