From 90aacbc5b5ccfaa3d513c29339caeafbeb1ffeff Mon Sep 17 00:00:00 2001 From: actionless Date: Tue, 21 Apr 2020 19:51:11 +0200 Subject: [PATCH] fix(gears: matcher: default_matcher): handle sidecase of string.match-ing the empty string ('') --- lib/gears/matcher.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/gears/matcher.lua b/lib/gears/matcher.lua index a0ad4bb48..636eb7aa5 100644 --- a/lib/gears/matcher.lua +++ b/lib/gears/matcher.lua @@ -79,7 +79,13 @@ local matcher = {} -- @see remove_matching_source local function default_matcher(a, b) - return a == b or (type(a) == "string" and a:match(b)) + local result = a == b + if result then return result end + if type(a) == "string" and type(b) == "string" then + result = a:match(b) + if result == '' then result = nil end + end + return result end local function greater_matcher(a, b)