From 005c2d61a0372be7cba06837e21d3fc5e3fb9eff Mon Sep 17 00:00:00 2001 From: Emmanuel Lepage Vallee Date: Thu, 21 Oct 2021 15:16:38 -0700 Subject: [PATCH] gears.matcher: Fix `rule_every`. It really didn't do the right thing and didn't work anyway. --- lib/gears/matcher.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/gears/matcher.lua b/lib/gears/matcher.lua index c7a66ca2..6f78b73e 100644 --- a/lib/gears/matcher.lua +++ b/lib/gears/matcher.lua @@ -133,7 +133,7 @@ end -- Check if an object matches any part of a rule. -- @param o The object. --- #tparam table rule The rule _match_anyto check. +-- @tparam table rule The rule to check. -- @treturn boolean True if at least one rule is matched, false otherwise. -- @method _match_any function matcher:_match_any(o, rule) @@ -146,6 +146,7 @@ function matcher:_match_any(o, rule) return true end + for _, value in ipairs(values) do if field_matcher(self, o, field, value) then return true @@ -160,7 +161,7 @@ end -- Check if an object matches at least one of every part of a rule. -- -- @param o The object. --- @tparam table rule The rule _match_anyto check. +-- @tparam table rule The rule to check. -- @tparam boolean multi If the entries are table of choices. -- @treturn boolean True if all rules are matched. -- @method _match_every @@ -170,7 +171,7 @@ function matcher:_match_every(o, rule) for field, values in pairs(rule) do local found = false for _, value in ipairs(values) do - if not field_matcher(self, o, field, value) then + if field_matcher(self, o, field, value) then found = true break end