aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Blott2016-04-24 08:49:45 +0100
committerStephen Blott2016-04-24 08:49:45 +0100
commit029741ea2d93031f0c9d5e57ba9cf75546976798 (patch)
tree16a9a5729e21c179d1c41401f05ec53065444d85
parentb353233e695033c0eb526db068ad538734a4503c (diff)
downloadvimium-029741ea2d93031f0c9d5e57ba9cf75546976798.tar.bz2
Filter filtered-mode link hints.
Only keep non-empty link words. Empty link words cannot be matched, and leading empty link words disrupt the scoring of matches at the start of the text. E.g. "9 new messages" with a query "new" should score as a match at the start of the text.
-rw-r--r--content_scripts/link_hints.coffee4
1 files changed, 3 insertions, 1 deletions
diff --git a/content_scripts/link_hints.coffee b/content_scripts/link_hints.coffee
index 702ff69d..d7f6191e 100644
--- a/content_scripts/link_hints.coffee
+++ b/content_scripts/link_hints.coffee
@@ -501,7 +501,9 @@ class FilterHints
scoreLinkHint: (linkSearchString) ->
searchWords = linkSearchString.trim().toLowerCase().split @splitRegexp
(linkMarker) =>
- linkWords = linkMarker.linkWords ?= linkMarker.linkText.toLowerCase().split @splitRegexp
+ # We only keep non-empty link words. Empty link words cannot be matched, and leading empty link words
+ # disrupt the scoring of matches at the start of the text.
+ linkWords = linkMarker.linkWords ?= linkMarker.linkText.toLowerCase().split(@splitRegexp).filter (term) -> term
searchWordScores =
for searchWord in searchWords