Le 24/07/2022 à 19:35, Jean-Marc Lasgouttes a écrit :
Le 24/07/2022 à 13:00, Kornel Benko a écrit :
Use this in user.bind
\unbind "Tab" "message *"
(for the proposed '\unbind "Tab" "*"' is more to do)
This seems to work. But the shortcut-dialog still shows the original
setting.
With this patch, your can unbind "*" directly. This seems cleaner to me.
But indeed I have no idea of how Prefs work... And since I use
LFUN_UNKNOWN_ACTION as a wildcard, I suspect that the prefs code, which
uses it for other reasons, will be also confused.
JMarc
With the patch now.
JMarc
diff --git a/src/KeyMap.cpp b/src/KeyMap.cpp
index f469da5c44..8cc50b6f98 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 == FunRequest::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 {
+ FuncRequest 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