Le 24/07/2022 à 19:52, Kornel Benko a écrit :
/usr2/src/lyx/lyx-git/src/KeyMap.cpp: In member function
‘lyx::KeyMap::ReturnValues
lyx::KeyMap::readWithoutConv(const lyx::support::FileName&,
lyx::KeyMap*)’: /usr2/src/lyx/lyx-git/src/KeyMap.cpp:337:16: error:
‘FunRequest’ has not
been declared if (func == FunRequest::unknown) { ^~~~~~~~~~
FunRequest--> FuncRequest
Also 'FuncRequest func = lyxaction.lookupFunc(cmd);' hid func from above (line
365)
Same effect. Works, but the dialog does not honour the setting.
Indeed, I forgot a few things :)
I would say that the rest shall be handled in
PrefShortcuts::insertShortcutItem
JMarc
diff --git a/src/KeyMap.cpp b/src/KeyMap.cpp
index f469da5c44..d15c2e4156 100644
--- a/src/KeyMap.cpp
+++ b/src/KeyMap.cpp
@@ -160,29 +160,30 @@ void KeyMap::unbind(KeySequence * seq, FuncRequest const & func, unsigned int r)
KeyModifier const mod2 = seq->modifiers[r].second;
// check if key is already there
+ vector <Table::iterator> removes;
Table::iterator end = table.end();
- Table::iterator remove = end;
for (Table::iterator it = table.begin(); it != end; ++it) {
if (code == it->code
&& mod1 == it->mod.first
&& mod2 == it->mod.second) {
// remove
if (r + 1 == seq->length()) {
- if (it->func == func) {
- remove = it;
+ if (it->func == func || func == FuncRequest::unknown) {
+ removes.push_back(it);
if (it->prefixes)
it->prefixes.reset();
}
} else if (it->prefixes) {
it->prefixes->unbind(seq, func, r + 1);
if (it->prefixes->empty())
- remove = it;
+ removes.push_back(it);
return;
}
}
}
- if (remove != end)
- table.erase(remove);
+
+ for (unsigned i = removes.size(); i > 0; --i)
+ table.erase(removes[i-1]);
}
@@ -333,7 +334,7 @@ KeyMap::ReturnValues KeyMap::readWithoutConv(FileName const & bind_file, KeyMap
string cmd = lexrc.getString();
FuncRequest func = lyxaction.lookupFunc(cmd);
- if (func.action() == LFUN_UNKNOWN_ACTION) {
+ if (func == FuncRequest::unknown) {
lexrc.printError("BN_BIND: Unknown LyX function `$$Token'");
error = true;
break;
@@ -357,13 +358,16 @@ KeyMap::ReturnValues KeyMap::readWithoutConv(FileName const & bind_file, KeyMap
break;
}
string cmd = lexrc.getString();
-
- FuncRequest func = lyxaction.lookupFunc(cmd);
- if (func.action() == LFUN_UNKNOWN_ACTION) {
- lexrc.printError("BN_UNBIND: Unknown LyX"
- " function `$$Token'");
- error = true;
- break;
+ FuncRequest func;
+ if (cmd == "*")
+ func = FuncRequest::unknown;
+ else {
+ func = lyxaction.lookupFunc(cmd);
+ if (func == FuncRequest::unknown) {
+ lexrc.printError("BN_UNBIND: Unknown LyX function `$$Token'");
+ error = true;
+ break;
+ }
}
if (unbind_map)
--
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel