[LyX/2.4.x] Consider masked modifiers (~S etc.) when writing to bind file
Juergen Spitzmueller
spitz at lyx.org
Mon Jul 29 16:15:14 UTC 2024
commit 451f3b27846de37125912afc384695a8c7fe047c
Author: Juergen Spitzmueller <spitz at lyx.org>
Date: Sun Jul 21 10:18:58 2024 +0200
Consider masked modifiers (~S etc.) when writing to bind file
Fixes #12973
(cherry picked from commit eb1ac06a9ad9bafd50c26fb951dd38a8d970c199)
---
src/KeyMap.cpp | 4 ++--
src/KeySequence.cpp | 11 +++++++++++
status.24x | 3 +++
3 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/src/KeyMap.cpp b/src/KeyMap.cpp
index c34fe7eefb..d841c08ca1 100644
--- a/src/KeyMap.cpp
+++ b/src/KeyMap.cpp
@@ -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));
}
}
diff --git a/src/KeySequence.cpp b/src/KeySequence.cpp
index c0985b78b9..80cd6dae0e 100644
--- a/src/KeySequence.cpp
+++ b/src/KeySequence.cpp
@@ -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;
diff --git a/status.24x b/status.24x
index cf29d67ff8..d3b70a0f5c 100644
--- a/status.24x
+++ b/status.24x
@@ -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.
More information about the lyx-cvs
mailing list