diff options
Diffstat (limited to 'content_scripts/link_hints.coffee')
| -rw-r--r-- | content_scripts/link_hints.coffee | 9 | 
1 files changed, 6 insertions, 3 deletions
diff --git a/content_scripts/link_hints.coffee b/content_scripts/link_hints.coffee index 6f95ac57..db8fe300 100644 --- a/content_scripts/link_hints.coffee +++ b/content_scripts/link_hints.coffee @@ -479,6 +479,9 @@ class FilterHints      @linkTextKeystrokeQueue = []      @labelMap = {}      @activeHintMarker = null +    # The regexp for splitting typed text and link texts.  We split on sequences of non-word characters and +    # link-hint numbers. +    @splitRegexp = new RegExp "[\\W#{Utils.escapeRegexSpecialCharacters @linkHintNumbers}]+"    #    # Generate a map of input element => label @@ -602,10 +605,10 @@ class FilterHints    # Assign a score to a filter match (higher is better).  We assign a higher score for matches at the start of    # a word, and a considerably higher score still for matches which are whole words.    scoreLinkHint: (linkSearchString) -> -    searchWords = linkSearchString.trim().split /\s+/ -    (linkMarker) -> +    searchWords = linkSearchString.trim().split @splitRegexp +    (linkMarker) =>        text = linkMarker.linkText.trim() -      linkWords = linkMarker.linkWords ?= text.toLowerCase().split /\s+/ +      linkWords = linkMarker.linkWords ?= text.toLowerCase().split @splitRegexp        searchWordScores =          for searchWord in searchWords  | 
