Consider masked modifiers (~S etc.) when writing to bind file

Fixes #12973

(cherry picked from commit eb1ac06a9a)
This commit is contained in:
Juergen Spitzmueller 2024-07-21 10:18:58 +02:00
parent f6074c329a
commit 451f3b2784
3 changed files with 16 additions and 2 deletions

View File

@ -568,11 +568,11 @@ void KeyMap::listBindings(BindingList & list,
// a LFUN_COMMAND_PREFIX // a LFUN_COMMAND_PREFIX
if (it->prefixes) { if (it->prefixes) {
KeySequence seq = prefix; 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); it->prefixes->listBindings(list, seq, tag);
} else { } else {
KeySequence seq = prefix; 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)); list.push_back(Binding(it->func, seq, tag));
} }
} }

View File

@ -147,16 +147,27 @@ docstring const KeySequence::print(outputFormat format, bool const untranslated)
break; break;
case BindFile: case BindFile:
KeyModifier mod = modifiers[i].first; KeyModifier mod = modifiers[i].first;
KeyModifier nmod = modifiers[i].second;
if (mod & ControlModifier) if (mod & ControlModifier)
buf += "C-"; buf += "C-";
else if (nmod & ControlModifier)
buf += "~C-";
if (mod & AltModifier) if (mod & AltModifier)
#if defined(USE_MACOSX_PACKAGING) || defined(USE_META_KEYBINDING) #if defined(USE_MACOSX_PACKAGING) || defined(USE_META_KEYBINDING)
buf += "A-"; buf += "A-";
else if (nmod & AltModifier)
buf += "~A-";
if (mod & MetaModifier) if (mod & MetaModifier)
#endif #endif
buf += "M-"; buf += "M-";
#if defined(USE_MACOSX_PACKAGING) || defined(USE_META_KEYBINDING)
else if (nmod & MetaModifier)
buf += "~M-";
#endif
if (mod & ShiftModifier) if (mod & ShiftModifier)
buf += "S-"; buf += "S-";
else if (nmod & ShiftModifier)
buf += "~S-";
buf += from_utf8(sequence[i].getSymbolName()); buf += from_utf8(sequence[i].getSymbolName());
break; break;

View File

@ -74,6 +74,9 @@ What's new
- Fix performance problems with references with (very) many authors. - 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 - Enable OK/Apply button in tabular dialog when "Additional Space" combo has
been set to different value. been set to different value.