Added the "matchesAny()" method to Keys

This commit is contained in:
00JCIV00 2024-02-25 12:44:02 -05:00 committed by Tim Culverhouse
parent 70f1e3495c
commit b57aab7040

View file

@ -60,6 +60,14 @@ pub fn matches(self: Key, cp: u21, mods: Modifiers) bool {
return false;
}
// matches against any of the provided codepoints.
pub fn matchesAny(self: Key, cps: []const u21, mods: Modifiers) bool {
for (cps) |cp| {
if (self.matches(cp, mods)) return true;
}
return false;
}
// matches base layout codes, useful for shortcut matching when an alternate key
// layout is used
pub fn matchShortcut(self: Key, cp: u21, mods: Modifiers) bool {