diff options
| author | Stephen Blott | 2016-04-24 10:35:46 +0100 |
|---|---|---|
| committer | Stephen Blott | 2016-04-24 10:35:49 +0100 |
| commit | 166efcbda9b1e9c32378b3226f8054f4f7109c22 (patch) | |
| tree | 6ac51d4c22231dfc307ab65b1d03140f393be2a0 | |
| parent | 64a54f252cadc1b3ea5865514482cd24e187f6bd (diff) | |
| download | vimium-166efcbda9b1e9c32378b3226f8054f4f7109c22.tar.bz2 | |
Filtered hints; tweak scoring.
Re-order the tests such that we don't even do the scoring if there are
no query (search) terms.
This might (very) marginally speed up link-hints launch.
| -rw-r--r-- | content_scripts/link_hints.coffee | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/content_scripts/link_hints.coffee b/content_scripts/link_hints.coffee index f44550bc..7153338b 100644 --- a/content_scripts/link_hints.coffee +++ b/content_scripts/link_hints.coffee @@ -481,7 +481,7 @@ class FilterHints hintMarkers .filter (linkMarker) => linkMarker.score = scoreFunction linkMarker - 0 < linkMarker.score or 0 == @linkTextKeystrokeQueue.length + 0 == @linkTextKeystrokeQueue.length or 0 < linkMarker.score .sort (a, b) -> if b.score == a.score then b.stableSortCount - a.stableSortCount else b.score - a.score @@ -501,6 +501,7 @@ class FilterHints scoreLinkHint: (linkSearchString) -> searchWords = linkSearchString.trim().toLowerCase().split @splitRegexp (linkMarker) => + return 0 unless 0 < searchWords.length # 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 |
