CheckKeybindingColission

This commit is contained in:
Krzosa Karol
2026-01-25 09:11:45 +01:00
parent 88dbfb1a6c
commit a9730924d7
3 changed files with 15 additions and 0 deletions

View File

@@ -245,3 +245,16 @@ void CMD_OpenLogs() {
void CMD_Errors() {
CMD_OpenLogs();
} RegisterCommand(CMD_Errors, "", "Opens the text editor logs and clear error counter");
void CheckKeybindingColission() {
ForItem (x, GlobalCommands) {
if (x.trigger == NULL) continue;
ForItem (y, GlobalCommands) {
if (y.trigger == NULL) continue;
if (&x == &y) continue;
if (x.trigger == y.trigger) {
ReportErrorf("Hotkey colission between: '%S' and '%S'", x.name, y.name);
}
}
}
}

View File

@@ -153,6 +153,7 @@ void Set(String string) {
if (trigger) {
cmd->binding = quote;
cmd->trigger = trigger;
CheckKeybindingColission();
}
return;
}

View File

@@ -1005,6 +1005,7 @@ int main(int argc, char **argv)
EnterOrEscapeKeySet = ParseKeyCached("escape | enter");
AltEnterKeySet = ParseKeyCached("alt-enter");
ShiftEnterKeySet = ParseKeyCached("shift-enter");
CheckKeybindingColission();
#if PLUGIN_CONFIG