]> git.lyx.org Git - lyx.git/commitdiff
Consider masked modifiers (~S etc.) when writing to bind file
authorJuergen Spitzmueller <spitz@lyx.org>
Sun, 21 Jul 2024 08:18:58 +0000 (10:18 +0200)
committerJuergen Spitzmueller <spitz@lyx.org>
Mon, 29 Jul 2024 16:14:45 +0000 (18:14 +0200)
Fixes #12973

(cherry picked from commit eb1ac06a9ad9bafd50c26fb951dd38a8d970c199)

src/KeyMap.cpp
src/KeySequence.cpp
status.24x

index c34fe7eefb9726afbc5d46bba821883e28895448..d841c08ca13db600f8c29c3d32405982c43acd50 100644 (file)
@@ -568,11 +568,11 @@ void KeyMap::listBindings(BindingList & list,
                // a LFUN_COMMAND_PREFIX
                if (it->prefixes) {
                        KeySequence seq = prefix;
-                       seq.addkey(it->code, it->mod.first);
+                       seq.addkey(it->code, it->mod.first, it->mod.second);
                        it->prefixes->listBindings(list, seq, tag);
                } else {
                        KeySequence seq = prefix;
-                       seq.addkey(it->code, it->mod.first);
+                       seq.addkey(it->code, it->mod.first, it->mod.second);
                        list.push_back(Binding(it->func, seq, tag));
                }
        }
index c0985b78b9b75d8f252437812a307798ad89cbc9..80cd6dae0e59875f69c9f562da6426532ff8da82 100644 (file)
@@ -147,16 +147,27 @@ docstring const KeySequence::print(outputFormat format, bool const untranslated)
                        break;
                case BindFile:
                        KeyModifier mod = modifiers[i].first;
+                       KeyModifier nmod = modifiers[i].second;
                        if (mod & ControlModifier)
                                buf += "C-";
+                       else if (nmod & ControlModifier)
+                               buf += "~C-";
                        if (mod & AltModifier)
 #if defined(USE_MACOSX_PACKAGING) || defined(USE_META_KEYBINDING)
                                buf += "A-";
+                       else if (nmod & AltModifier)
+                               buf += "~A-";
                        if (mod & MetaModifier)
 #endif
                                buf += "M-";
+#if defined(USE_MACOSX_PACKAGING) || defined(USE_META_KEYBINDING)
+                       else if (nmod & MetaModifier)
+                               buf += "~M-";
+#endif
                        if (mod & ShiftModifier)
                                buf += "S-";
+                       else if (nmod & ShiftModifier)
+                               buf += "~S-";
 
                        buf += from_utf8(sequence[i].getSymbolName());
                        break;
index cf29d67ff84424a72da2bf0e92514c8fb4de6963..d3b70a0f5cdc32a06825adf78b122cc9dfe45e2f 100644 (file)
@@ -74,6 +74,9 @@ What's new
 
 - Fix performance problems with references with (very) many authors.
 
+- Fix problem that key bindings that include optional modifier keys could not
+  be un- or re-bound (bug 12973)
+
 - Enable OK/Apply button in tabular dialog when "Additional Space" combo has
   been set to different value.