From b57aab7040173b53653951bbcf226d0c220464b0 Mon Sep 17 00:00:00 2001 From: 00JCIV00 Date: Sun, 25 Feb 2024 12:44:02 -0500 Subject: [PATCH] Added the "matchesAny()" method to Keys --- src/Key.zig | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Key.zig b/src/Key.zig index 1c19186..40e8437 100644 --- a/src/Key.zig +++ b/src/Key.zig @@ -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 {