From 877372208a02bbe7d66b122c3c6b26f54fe4e27e Mon Sep 17 00:00:00 2001 From: Simon Lydell Date: Thu, 12 Nov 2015 08:10:54 +0100 Subject: [PATCH] Fix prev/next patterns order not respected Fixes #602. --- extension/lib/commands-frame.coffee | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/extension/lib/commands-frame.coffee b/extension/lib/commands-frame.coffee index 76b54ca..a319672 100644 --- a/extension/lib/commands-frame.coffee +++ b/extension/lib/commands-frame.coffee @@ -245,18 +245,17 @@ commands.follow_pattern = ({ vim, type, options }) -> attrs = options.pattern_attrs matchingLink = do -> - # Helper function that matches a string against all the patterns. - matches = (text) -> patterns.some((regex) -> regex.test(text)) - # First search in attributes (favoring earlier attributes) as it's likely # that they are more specific than text contexts. for attr in attrs - for element in candidates - return element if matches(element.getAttribute(attr)) + for regex in patterns + for element in candidates + return element if regex.test(element.getAttribute(attr)) # Then search in element contents. - for element in candidates - return element if matches(element.textContent) + for regex in patterns + for element in candidates + return element if regex.test(element.textContent) return null -- 2.39.3